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

what does the m# do? m is for match, but I don't understand what the # does.

Replies are listed 'Best First'.
Re^3: Regular expression question
by gube (Parson) on Mar 31, 2006 at 07:50 UTC

    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

      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