Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: questions of a perl beginner on regex

by liverpole (Monsignor)
on Jun 20, 2006 at 12:13 UTC ( [id://556360]=note: print w/replies, xml ) Need Help??


in reply to questions of a perl beginner on regex

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$..$/
  • Comment on Re: questions of a perl beginner on regex

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://556360]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-04-25 14:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found