Regex issues

Post Reply
pax
Posts: 7
Joined: Wed May 06, 2009 1:32 am

Regex issues

Post by pax »

Code: Select all

You quickly flow into the (\w+) stance.
I use this to capture which stance I'm in as I do my dance as an Idras in Imperian. The stances are: None, Gyanis, Rizet, Laesan, Vae-Sant, and Ein-Fasit. I can catch any but the last two. I guess it's because of the hyphen, but I don't know. Is there any easy way around this?

Ramiel
Posts: 15
Joined: Sat Apr 25, 2009 5:57 am

Re: Regex issues

Post by Ramiel »

Yup, its because of the hyphen.

Use this:

Code: Select all

You quickly flow into the (Gyanis|Rizet|Laesan|Vae-Sant|Ein-Fasit) stance.
This also has the bonus of being much more efficient. I didn't include none as, well, you can't match none with that line as Idra. :)

User avatar
Vadi
Posts: 5048
Joined: Sat Mar 14, 2009 3:13 pm

Re: Regex issues

Post by Vadi »

Small note so you understand: \w means a single alphanumeric characters. This means letters from A-Z and numbers from 0-9 only. Other characters don't match in.

pax
Posts: 7
Joined: Wed May 06, 2009 1:32 am

Re: Regex issues

Post by pax »

Cool, thanks very much for the help

Post Reply