You probably were aware of this and just mistyped, but...
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:
? -- optional, zero or one
+ -- required and repeatable, one or more
* -- optional and repeatable, zero or more
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).
There is a great book, Mastering Regular Expressions on this topic that is a very worthwhile read. |