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

496Re: [NTS] Trying to perfect RegExp to match various numbers

Expand Messages
  • Sheri
    Mar 29 8:04 AM
    • 0 Attachment
      Hi Joy,

      A caret inside a character class negates the character class. Outside of
      a character class it indicates BOL (beginning of the the line). Avoid
      making the very first character of a pattern a caret, because NoteTab
      Pro (but not Std or Lite) sometimes advances the cursor before testing
      the regex if it is.

      Sounds like you wanted to match whole lines with one in, so you could do

      (?:^|.*?\s)[\+\-]?[0-9,\.]+(?=\s).*$

      Otherwise, try

      (?:^|\s)\K[\+\-]?[0-9,\.]+(?=\s|$)

      Hope that helps. I've escaped the plus and the period in character
      classes above, which is my habit but isn't strictly necessary. It is
      necessary to escape a hyphen in a character class.

      Regards,
      Sheri
    • Show all 14 messages in this topic