Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Regular expression question

by gube (Parson)
on Mar 31, 2006 at 07:50 UTC ( [id://540405]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Regular expression question
in thread Regular expression question

Hi rangersfan,

(/) This is the usual delimiter for the text part of a regular expression. you can also use (#) as delimiter. By using usual delimiter with regexp i have given the code below you can also refer that for your understand :-p

Replies are listed 'Best First'.
Re^4: Regular expression question
by rangersfan (Novice) on Mar 31, 2006 at 07:52 UTC
    learn something new everyday.... thanks!
      You can choose other symbols, eg the pipe symbol '|' or you can choose bracket pairs eg m{^abc}. Note that the slash '/' is the default character and using this allows you to omit the 'm' operator, eg /^abc/. The usual reason to choosing something other than the '/' is when matching on *nix paths so that you don't have to keep escaping the '/'s, eg /\/path\/to\/file/ versus m#/path/to/file#.

      You can also choose different delimiters for doing substitution, eg s|/path/to/|| or s{abc}{xyz}. Note when using paired brackets you need a set around both the "to be replaced" and the "replace with" strings.

      Cheers,

      JohnGG

Log In?
Username:
Password:

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

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

    No recent polls found