in reply to Re: Regexpresions
in thread Regexpresions
The ? when used as it is in .? means zero or one, as stated by another poster above. .? does not mean one or more, that would be .+.
A quick list:
All of these can be modified by placing a '?' after them, .+? in this usage however the '?' is affecting the greediness of the operator. Without the '?' it will attempt to match as many as possible (greedy), with the '?' it will attempt to match as few as required (non-greedy).? -- optional, zero or one + -- required and repeatable, one or more * -- optional and repeatable, zero or more
There is a great book, Mastering Regular Expressions on this topic that is a very worthwhile read.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Regexpresions
by ozone (Friar) on Aug 22, 2001 at 14:13 UTC | |
|
Re: Re: Re: Regexpresions
by Anonymous Monk on Aug 21, 2001 at 18:14 UTC |