cancel
Showing results for 
Search instead for 
Did you mean: 

Irregular expressions

Don
New Contributor

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.

 

1 ACCEPTED SOLUTION

lwisinski
New Contributor

Hey,

try to add g at the end of your regex expression:

lwisinski_0-1721376272830.png

Regards

View solution in original post

1 REPLY 1

lwisinski
New Contributor

Hey,

try to add g at the end of your regex expression:

lwisinski_0-1721376272830.png

Regards