Hello. I'm trying to modify a regex script to add an exception. Currently, the script is designed to add a space after a set of defined punctuation marks if it immediately precedes another alphanumeric character (e.g. "There,There" converts to "There, There"). Here's the script:
Action type: Replace with regular expression
Field: _TAG
Regular expression: ([&)}];,+])([^\s.:;([/])
Replace matches with: $1 $2
[ ] case-sensitive comparison
The problem with this script is that large numbers become fragmented. For instance, "10,000" gains an unwanted space after the comma, thus I end up with "10, 000". My initial idea was to use a negative lookahead and lookbehind for numbers (i.e. if there is a number before the comma, AND three numbers after it, then do not add a space). I had something like this in mind: (?<!\d),(?!\d{3})
Now, as you cannot use groups within a character class, I would have to change the regex to this:
Action type: Replace with regular expression
Field: _TAG
Regular expression: (&|)|}|]|;|(?<!\d),(?!\d{3})|+)([^\s.:;([/])
Replace matches with: $1 $2
[ ] case-sensitive comparison
Unfortunately however, for reasons that I don't quite understand, I cannot get this to work. Using just the lookahead, or just the lookbehind woks, but not both together. I'm stumped on this one. I'm sure there's a simple solution to this, but I just can't see it. Does anyone here know how to fix this? Cheers.