Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Re: Regular Expression Question: Is this syntax legal?

Expand Messages
  • Jenda Krynicky
    From: Marcos Ramos ... No. In this case Perl interpolates the variable into the regexp and uses the contents as part of the
    Message 1 of 10 , Aug 10, 2009
    • 0 Attachment
      From: Marcos Ramos <marcos.ramos@...>
      > "/^$thing/"
      >
      > Isn't that because you have $ (end line regex) just after ^ (line
      > start reged) ?
      > So it tries to match empty line followed by the word "thing".

      No. In this case Perl interpolates the variable into the regexp and
      uses the contents as part of the regexp. The thing is that if there
      are any characters special for regexps they are treated specially. So
      if $thing contains '[test]', then the regexp checked will be
      /^[test]/. Which means ... find one of the characters "t", "e" or "s"
      at the beginning of the matched string.

      Jenda
      ===== Jenda@... === http://Jenda.Krynicky.cz =====
      When it comes to wine, women and song, wizards are allowed
      to get drunk and croon as much as they like.
      -- Terry Pratchett in Sourcery
    Your message has been successfully submitted and would be delivered to recipients shortly.