String Replace: RegEx requires double escape

Hi,

when using this RegEx \d(?:[.,0-9/-\s]+)?[\w]+\s? this error is thrown Invalid node settings: Coding issue: Illegal character range near index 14.

I figured that, after counting to the failing position, a double escape might be required which seems counter intuitive or at least inconsistent: \d(?:[.,0-9/-\\s]+)?[\w]+\s?

I’d like to suggest to either fix the cause or improve the error message but depending on the RegEx implementation, the later might cause more work considering other edge cases.

PS: This RegEx does work without double escaping (^|[^\d])\.

Best
MIke

The problem lies in the regex, not in the node’s behaviour. The - in your regex indicates a character range such as a-z. However, a character range /-\s doesn’t make sense because \s stands for multiple characters. If you simply want to match a - then you have to escape the -: [.,0-9/\-\s]
The reason why it works with \\s is that you now have a character range /-\ plus a single s character.

2 Likes