P is for Practical | |
PerlMonks |
Re: questions of a perl beginner on regexby liverpole (Monsignor) |
on Jun 20, 2006 at 12:13 UTC ( [id://556360]=note: print w/replies, xml ) | Need Help?? |
Hi jithoosin,
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. s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
In Section
Seekers of Perl Wisdom
|
|