in reply to misc. regex questions

To try to clarify duff's quote:

^ and \A are usually the same; it's only with the //m modifier that they differ (since then ^ will match at the beginning of the string or after a newline, \A can still be used to match only the beginning of the string).

$ and \Z are usually the same (matching at the end of the string or just before a newline at the end of the string) but, again, differ with //m (where $ will match at the end of the string or before any newline). \z differs from either in that it matches only the end of the string, with or without //m.

Replies are listed 'Best First'.
Re: Re: misc. regex questions
by Anonymous Monk on Apr 11, 2004 at 06:39 UTC
    ^ and \A are NEVER the same. They may match the same thing in some cases but they are never the same.
      By "same" I meant "match (or don't match) in the same circumstances [in the absence of the m flag]". Is this just a semantic quibble or are you saying this expanded phrase is not accurate?