HandyFile Find And Replace: Text Workbench Online Help Submit feedback on this topic   

HOWTO: Search And Replace Text Using Regular Expressions

To find file(s) containing the text that matches a pattern and replace the text in them, do the following.

  1. Specify the folder in which you want to find files. For example: C:\MyWebFiles\Projects
  2. Set mask(s) of the files that you want to find. For example: *.htm*;*.asp;*.cpp
  3. Provide the pattern in the Find What field for the matching text that you want to find.

    For example, you want to replace the CENTER value of the ALIGN attributes with LEFT in all <TABLE> tags in HTML files. The corresponding pattern would include:

    • the opening tag - \<;
    • tag name (TABLE);
    • as the tag may contain other attributes, some wildcard operator and repetition operator enclosed in the expression operator for further reference - (.#);
    • ALIGN attribute and a value - ALIGN\=CENTER;
    • as the tag may contain other attributes after ALIGN, some wildcard operator and repetition operator enclosed in the expression operator for further reference - (.#);
    • the closing tag - \>.

    The pattern in this case would look as follows:

    \<TABLE(.#)ALIGN\=CENTER(.#)\>


  4. Provide the replacement expression, where \1 and \2 stands for the previously remembered parts of text (.#):

    \<TABLE\1ALIGN=LEFT\2\>

  5. If you want to first see what you will replace, click the Search button. 
  6. Make sure the option Search only is unchecked.
  7. Click the Replace button.