This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Regexp Problems...

Old posts that have not been replied to for several years.
Locked
L
LexXx
Voice
Posts: 13
Joined: Mon Jun 14, 2004 11:32 am
Location: Bereldange/Luxembourg
Contact:

Regexp Problems...

Post by LexXx »

Code: Select all

regexp -nocase {.*\[hot: \.((\d)+)/((\d)+)/((\d)+).*} $topic a cipx(hotserver) b cipx(hotlwe) c cipx(hotact);
regexp -nocase {.*\[cold: \.((\d)+)/((\d)+)/((\d)+) \.((\d)+)/((\d)+)/((\d)+).*} $topic a cipx(cold1server) b cipx(cold1lwe) c cipx(cold1act) d cipx(cold2server) e cipx(cold2lwe) f cipx(cold2act);
This code works good when the topic is under a certain layout like this one:

Code: Select all

4[Hot: .30/813/899 ]10 [Cold: .59/1471/1496 ] 15.999/999/999 [ 
but not when there is only 1 pair of numbers under cold or 2 under hot...

my question ius how to make it more flexible, maybe that it detects how many ips there are etc. i dont know what's possible with regexp 8)

ty for your help + mfg Lex
Image
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

You didn't tell me enough about the format to be sure it'll work, but try this:

Code: Select all

set crap {4[Hot: .30/813/899 ]10 [Cold: .59/1471/1496 ] 15.999/999/999 [}
if {[regexp {\[Hot:(.*?)\].*?\[Cold:(.*?)\]} $crap hot hot cold]} {
	set hots [regexp -all -inline {\.[0-9]+/[0-9]+/[0-9]+} $hot]
	set colds [regexp -all -inline {\.[0-9]+/[0-9]+/[0-9]+} $cold]
}
Have you ever read "The Manual"?
L
LexXx
Voice
Posts: 13
Joined: Mon Jun 14, 2004 11:32 am
Location: Bereldange/Luxembourg
Contact:

Post by LexXx »

uhm have to read it again later cos i dont understand whats nex to that oO
Image
Locked