Thursday 15 August 2013

javascript - Find and Replace using Regular Expression -


Good answer should be very simple. But I'm new to regular expressions.

What do I want to do, just search and replace:

Example: IT $% # sa12c@#ombina#$tion.43of // 45simp5./l7e5andsp75e$%cial23 $ # Of% charecters

In place of "ki" with the word "ki" in place of

I tried to do it but the result was not received, please help me.

  string = "ITI $% # sa12c@#ombina#$tion.43of//.45simp5./l7e5andsp75e$%cial23$#of%charecters"; Var string2 = string.replace ("/ (\ w * w *) of (\ w * \ w *) / g", "$ 1in $ 2"); Console.warn (string2);    

Why not a simple var place = yourString.replace (/ of / G, 'in'); ?

No comments:

Post a Comment