in reply to questions of a perl beginner on regex
It depends on which "?" you mean.
The typical use of "?" in a regex is "zero or one" of the preceding thing.Of course, another way to say "zero or one", is "optional". So, for example, in "(?:\?.*)?", the final "?" means that "(?:\?.*)" is optional.
The second "?" (in "\?") stands for a single "?" (since it's escaped with "\").
However, the first "?":  :"(?:...)" has a different meaning, which is that it turns off the "capture" that would usually happen with "(...)".
You should read more about perl regular expressions to get the full scoop.
|
|---|