
26 Sep
2005
26 Sep
'05
2:09 a.m.
I'm attempting to learn xpressive by writing a simple IRC regex. The IRC protocol goes like: :prefix numericreplyorcommandstring param1 param2 :trailing param The regex looks like this (ignore comments and newlines): ^ (?::(\S+)\s)? // prefix (?:(\d+)|(\S+)) // command (?:\s([^:]\S*))* // parameters (?:\s:(.+))? // trailing parameter $ And my static xpressive looks like this: bos >> optional(':' >> (s1=+~_s) >> _s) >> // prefix ((s2=+_d)|(s3=+~_s)) >> // command *(_s >> (s4 = ~as_xpr(':') >> *~_s)) >> // parameters optional(_s >> ':' >> (s5=+_)) >> // trailing parameter eos I'm not sure how to retrieve the multiple matches for s4 - any help? -- Cory Nelson http://www.int64.org