egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

small regexp to convert a url

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Jagg
Halfop


Joined: 24 Jan 2004
Posts: 53

PostPosted: Wed May 23, 2012 9:55 am    Post subject: small regexp to convert a url Reply with quote

Hi,

which regexp do I need to regexp a url like
Code:
http://www.ftd.de/finanzen/maerkte/:zahlungsverzug-die-bonitaet-der-kunden-pruefen/70040990.html#utm_source=rss2&utm_medium=rss_feed&utm_campaign=/finanzen/maerkte

to
Code:
www.ftd.de/article/70040990.html


So
- www.ftd.de is always the same
- look for int value followed by ".html" (here 70040990.html)
- the transform it to "www.ftd.de/article/70040990.html"

Thanks


Last edited by Jagg on Wed May 23, 2012 12:45 pm; edited 2 times in total
Back to top
View user's profile Send private message
doggo
Halfop


Joined: 05 Jan 2010
Posts: 97

PostPosted: Wed May 23, 2012 11:37 am    Post subject: Reply with quote

summit like this? untested but should do the job

Code:


set url "http://www.url.de/finanzen/maerkte/:zahlungsverzug-die-bonitaet-der-kunden-pruefen/70040990.html#utm_source=rss2&utm_medium=rss_feed&utm_campaign=/finanzen/maerkte"

regexp {.*([0-9]+).html.*} $url match html_id

set new_url "http://www.url.de/article/$html_id.html"


_________________
NON geeky!! http://gotcode4u.com/
Back to top
View user's profile Send private message Visit poster's website
Jagg
Halfop


Joined: 24 Jan 2004
Posts: 53

PostPosted: Thu May 24, 2012 8:05 am    Post subject: Reply with quote

Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber