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

Re: [NTB] Re: reg-exp question

Expand Messages
  • buralex@gmail.com
    ... Sheri is of course correct, but just for fun, here is how RegexBuddy explains your regular expression: mystery regexp
    Message 1 of 3 , Nov 24, 2006
      --- In notetab@yahoogroups.com, "dave" <dmc43959@...> wrote:
      > > Hi the part of the reg-ex below was used earlier on the
      > > list with four lines of text could someone tell me what
      > > ?<= at the beginning I think it is looks ahead and
      > > checks?? the first line of text so it knows it is there
      > > ,the ?= at the end looks back at the last line of text.
      > > am I close ?? ^!Replace
      > > "(?<=\r\n|\A)(.+)\r\n(.+)\r\n(.+)\r\n(.+)(?=(\r\n|\z))"
      >
      > "(?<=" is called a look behind assertion, what follows it specifies
      > what must preceed a match. "(?=" signals a look ahead, which specifies
      > what must follow a match. But regexp questions belong on the clips
      > list, not this basic list.
      Sheri is of course correct, but just for fun, here is how RegexBuddy
      explains your regular expression:
      mystery regexp

      (?<=\r\n|\A)(.+)\r\n(.+)\r\n(.+)\r\n(.+)(?=(\r\n|\z)

      Options: ^ and $ match at line breaks

      Assert that the regex below can be matched, with the match ending at
      this position (positive lookbehind) «(?<=\r\n|\A)»
      Match either the regular expression below (attempting the next
      alternative only if this one fails) «\r\n»
      Match a carriage return character «\r»
      Match a line feed character «\n»
      Or match regular expression number 2 below (the entire group fails if
      this one fails to match) «\A»
      Assert position at the start of the string «\A»
      Match the regular expression below and capture its match into
      backreference number 1 «(.+)»
      Match any single character that is not a line break character «.+»
      Between one and unlimited times, as many times as possible, giving
      back as needed (greedy) «+»
      Match a carriage return character «\r»
      Match a line feed character «\n»
      Match the regular expression below and capture its match into
      backreference number 2 «(.+)»
      Match any single character that is not a line break character «.+»
      Between one and unlimited times, as many times as possible, giving
      back as needed (greedy) «+»
      Match a carriage return character «\r»
      Match a line feed character «\n»
      Match the regular expression below and capture its match into
      backreference number 3 «(.+)»
      Match any single character that is not a line break character «.+»
      Between one and unlimited times, as many times as possible, giving
      back as needed (greedy) «+»
      Match a carriage return character «\r»
      Match a line feed character «\n»
      Match the regular expression below and capture its match into
      backreference number 4 «(.+)»
      Match any single character that is not a line break character «.+»
      Between one and unlimited times, as many times as possible, giving
      back as needed (greedy) «+»
      Assert that the regex below can be matched, starting at this position
      (positive lookahead) «(»
      Match the regular expression below and capture its match into
      backreference number 5 «(\r\n|\z)»
      Match either the regular expression below (attempting the next
      alternative only if this one fails) «\r\n»
      Match a carriage return character «\r»
      Match a line feed character «\n»
      Or match regular expression number 2 below (the entire group fails
      if this one fails to match) «\z»
      Assert position at the very end of the string «\z»


      Created with RegexBuddy


      Regards ... Alec -- buralex-gmail
      --



      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.