Andrew Smirnov
Andrew Smirnov

Reputation: 31

regex for regex result or twice regex

i want to select all money numbers (red) and this is regex which doesn't work Text

I can improve regex so that it'll select all numbers ranges like this Text

May I use some post select regex to remove all dates/time from it? like where it doesn't contain '/' and double '.' and ':'

Upvotes: 0

Views: 96

Answers (1)

Wiktor Stribiżew
Wiktor Stribiżew

Reputation: 626806

You may use

\b(?<!\d[:\/.])\d+(?:,\d+)*(?:\.\d+)?(?![.\/:]?\d)

See the regex demo

Regex details

  • \b - a word boundary
  • (?<!\d[:\/.]) - no digit + :, / or . allowed immediately to the left of the current location
  • \d+ - 1+ digits
  • (?:,\d+)* - zero or more occurrences of , and 1+ digits
  • (?:\.\d+)? - an optional occurrence of . and 1+ digits
  • (?![.\/:]?\d) - no optional ., / or : followed with a digit are allowed immediately to the right of the current location.

Upvotes: 2

Related Questions