search and replace (regex patterns)

with the search and replace you can do increadible things. We'll start with a simple example. In some HTML table we have several table data tags where we actually want table header tags. Table data is <td></td> and we want <th></th>.

we can do two normal replaces: one where we replace <td> with <th> and then another where we replace </td> with </th>

we can also do one replace using regular expressions: find (<|</)?td> and replace with \0th> For more information about regular expressions you might want to read man 7 regex, or read any of the great internet sites about regular expressions. The \0 in the replace string refers to the first subpattern match in the search pattern, the \1 to the second etc.

if you understand the above example, you will realize that you can do much more. Suppose you also want to match a table data tag that does have some attributes like <td class="myclass">, and you want to keep the option while converting to table header. The following pattern will do this: find (<|</)td([^>]*)> and replace with \0th\1>

if you have any search and replace patterns you use often, you can also add them to the Custom Menu. Check the Custom Menu section of this manual for more information.