Beefy Boxes and Bandwidth Generously Provided by pair Networks kudra
Welcome to the Monastery
 
PerlMonks  

Re^3: Regular expression question

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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 02: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
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.