Mike's JavaScript and AJAX

Use Regular Expressions to change a string

Enter a Regular Expression to find text to change

Turn on multiline flag

For the rules on regular expressions see the notes at the bottom of this page.

Enter the regular expresssion or text to change the previouslly found text to.
Enter the data to run the regular expression in the first row against.
Click this to run the regular expression in the first row against the text in the third row and make the changes specified in the 2nd row.
Your regular expression is:
 
Command Executed
 

These are all the strings from the data in the 2nd box that match the regular expression in the first box.
Variables set in RegExp.xxxx
 

  1. Regular expressions normally begin and end with a / like
    /regular expression/
  2. Regular expressions can end with a modifier such as i, g or m like
    /regular expression/igm
  3. This program does not validate the regular expression you enter.
  4. For more information on regular expressions check out 1 2

NOTES:

1) I didn't add the logic to this program to handle data that contains < and > and & data. Sometimes the code will work, sometimes it won't. I just created this program as toy to play with regular expession in JavaScript.

2) I don't validate any of the regular expression entered. If you enter an invalid regular expression the code usually just displays the results from the last valid regular expression

3) It seems that Microsoft Internet Explorer regular expressions work slightly different them regular expressions under Mozilla FireFox and Google Chrome. Or at least how the data is displayed in the output box is slightly different. I still have to analyize what it is doing.

DEBUG BOX

Results 2

Home