Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String replacement, regular expressions

Tags:

regex

krl

I'd like to do string replacement in the pre block of a rule using regular expressions. I know there is a function to do that, but I can't find it. Hints?

I'm thinking something like this:

origStr = "Original-string-has-hyphens";
newStr = origStr.replace(re/-/ /g);

The result being that newStr = "Original string has hyphens".

EDIT: Just realized that I asked a similar question a few months ago, but I never quite got a working answer.

like image 769
Steve Nay Avatar asked May 07 '26 22:05

Steve Nay


2 Answers

Documentation can be found at http://docs.kynetx.com/docs/Replace I found it using my Kynetx docs search tool http://supersearcher.michaelgrace.org/

like image 125
Mike Grace Avatar answered May 10 '26 19:05

Mike Grace


what about origStr.replace("-", " ");

like image 27
anubhava Avatar answered May 10 '26 18:05

anubhava



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!