Page 1 of 1

Regex issues

Posted: Wed May 06, 2009 1:42 am
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?

Re: Regex issues

Posted: Wed May 06, 2009 2:00 am
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. :)

Re: Regex issues

Posted: Thu May 07, 2009 12:45 am
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.

Re: Regex issues

Posted: Thu May 07, 2009 3:33 am
by pax
Cool, thanks very much for the help