Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Sylmannemo
Beginner


Joined: 20 Oct 2006
Posts: 18

PostPosted: Tue Aug 21, 2007 4:48 am   

Why does my Regex never seem to work...
 
Ok, so a standard form of the prompt would be something such as this...

<382/382h 290/290m 1813e 1350w 28x <ebpp> <bd>>
Format being <(health/maxhealth)h (mana/maxmana)m (endurance)e (willpower)w (experience)x <(balance/equilibrium, etc)> <(blind deaf flying prone etc.)>

Using a previous propmt regex I had similar to this I thought I designed it correct off of it but I can't seem to get any pattern to match

As it stands the design I have is...

^\<(\d+)\/(/d+)\h (\d+)\/(\d+)\m (?:\d+)\e (?:\d+)\w (?:\d+)\x \<(.*?)\> \<(.*?)\>\>

The pattern test is coming up as

<123//dabc123 123/123abc123 ?:123 ?:123abc ?:123abc123 <abc 123 xyz?> <abc 123 xyz?>>

No matter how much I play with regex, despite my love for its beautiful potential and use, I can never really manage to understand why I encounter problems with it, and I just want to thank anyone who helps me in advance!
Reply with quote
Zhiroc
Adept


Joined: 04 Feb 2005
Posts: 246

PostPosted: Tue Aug 21, 2007 5:03 am   
 
You've got a forward slash before one of the 'd's, and you have far, far, too many backslashes. \e, \w, and \x all have meanings in REs. And the rest are just superfluous.

Use:
Code:
^<(\d+)/(\d+)h (\d+)/(\d+)m (?:\d+)e (?:\d+)w (?:\d+)x <(.*?)> <(.*?)>>

instead.

BTW, this is the online reference I use for RE syntax.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
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

© 2009 Zugg Software. Hosted by Wolfpaw.net