07-17-2024 03:12 PM
I'd like to say that I'm tearing my hair out, but I don't have any.
Regular expressions seem to be taking a left turn for me today and I was hoping to some clarity.
I'm building statements dynamically in a Mapper Snap (437patches26643) and want to remove or replace certain patterns. That started with "removing WHERE with any spaces before or after" and went down to "let's see if I can just replace all spaces with a single space".
Sample string: "this is a test WHERE WHERE WHERE "
("this is a test WHERE WHERE WHERE ").replace(/\s*/, ' ')
("this is a test WHERE WHERE WHERE ").replace(/\s+/, ' ')
("this is a test WHERE WHERE WHERE ").replace(/[[:space:]]*/, ' WHERE') <-- yeah, I went POSIX just because.
("this is a test WHERE WHERE WHERE ").replace(/\s*WHERE/, ' WHERE')
None of them work within the app. They all seem to work for the flavors supported by regex101.com .
Any help is greatly appreciated.
Solved! Go to Solution.
07-19-2024 01:05 AM
07-19-2024 01:05 AM
Hey,
try to add g at the end of your regex expression:
Regards