in reply to Re: How to match and transform a multiline pattern?
in thread How to match and transform a multiline pattern?

Thanks. This works great! I must say that I do not understand your regular expression yet, I only know the s/.../.../ variety. Haven't seen the "s[][]" variety yet. I guess I need to read up on regex now :-).

Thanks again.
  • Comment on Re^2: How to match and transform a multiline pattern?

Replies are listed 'Best First'.
Re^3: How to match and transform a multiline pattern?
by BrowserUk (Patriarch) on Apr 20, 2007 at 19:46 UTC
    I only know the s/.../.../ variety. Haven't seen the "s[][]" variety yet.

    They are the same, they just use different delimiters. You can choose which character(s) you use as a delimiter. If you use bracketing delimiters (eg. () or {} or [] or <>) then it can simplify the use of somethings. See the docs for the full skinny.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re^3: How to match and transform a multiline pattern?
by GrandFather (Saint) on Apr 20, 2007 at 23:12 UTC

    See perlretut and perlre for a start. If you are new to Perl then have a good browse around the Tutorials section here too.

    A small nomenclature note: the "regular expression" is the bit that does the matching. In a substitution it is the first expression. In a match it is the only expression. In a substitution the other expression is called the substitution expression.

    For complicated regular expressions it is often helpful to use the /x switch which allows you to use white space and comments in your expression so that it is easier to see the different parts and to provide comments for the parts of the expression.


    DWIM is Perl's answer to Gödel
      Thanks so much - great information. I am ready to dive in!