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

551Re: [NTS] Can a Reg Exp handle 123 AND not a|b|c followed by x?

Expand Messages
  • mycroftj
    May 12, 2012
    • 0 Attachment
      --- In ntb-scripts@yahoogroups.com, "flo.gehrke" <flo.gehrke@...> wrote:
      >
      > --- In ntb-scripts@yahoogroups.com, Alec Burgess <buralex@> wrote:
      > > So here is the ^!Find statement
      > > ^!Find
      > > "(?i)(?:\d{2}/\d{2}/\d{4}|\d{4}/\d{2}/\d{2})\x20\((?!mon|tue|wed|thu|fri|sat|sun).{3}\)"
      > > RIS
      > > Note: AFAIK the T modifier has no effect when using R option.
      >
      > With 'I' and '(?i)', the 'ignore case' option is applied even twice in your pattern -- although, like 'T', it isn't needed here. The RegEx matches 'MON' or 'mon' as well.
      >
      > If there's no need to capture anything, you could make not only the date but the whole pattern non-capturing...
      >
      > (?:(\d{2}/\d{2}/\d{4}|\d{4}/\d{2}/\d{2})\x20\((?!mon|tue|wed|thu|fri|sat|sun).{3}\))
      >
      > or enclose the whole pattern in an Atomic Group...
      >
      > ^!Find "^(?>\d{2,4}/?){3}\x20\((?!Mon|Tue|Wed|Thu|Fri|Sat|Sun).{3}\)" RS
      >
      > Regards,
      > Flo
      >


      Flo,

      Thank you so much for that. I was close! For some reason, I never realized a look-behind or look-ahead could come in the middle of a regexp. I don't recall ever seeing that in an example. But it can and is perfect and I learned a very important thing.

      Thank you always for your answers and remember how many people learn by seeing others discuss EVERYTHING here.

      Regards

      Joy
    • Show all 13 messages in this topic