On Mon, 14 Jan 2008, Junkone wrote:

> Hello
> I have with great effort started on teh regex implemention and am
> stuck at one point.
> here is my code
> (add)\s+\S+\s+[i|s|f]\s+[pei]?\s+
>
> The string is as follows and the tokens are equavalent to
> 1 token=Add

Unless you use the i modifier, ruby regexps are case sensitive. So
/add/ won't match /Add/, but /add/i will.

> 2 token=any text
> 3. token=one of the following i or s or f

You want /[isf]/ /[i|s|f]/ is probably equivalent to /[isf|]/

> 4.token= 0 or 1 of the following characters [p e i]
/[pei]?/

>
> I am stuck at the 4th token.  i thought ? after the token will give
> the 0 or 1 option.
It does.

> pl correct me if i made a error

Show the exact regexp and the string it failed on.



John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter / tait.co.nz
New Zealand