开发者

String replacement, regular expressions

开发者 https://www.devze.com 2023-02-17 17:31 出处:网络
I\'d like to do string replacement in the pre block of a rule using regular expressions. I know there is开发者_JAVA技巧 a function to do that, but I can\'t find it. Hints?

I'd like to do string replacement in the pre block of a rule using regular expressions. I know there is开发者_JAVA技巧 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.


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消