# Regular Expressions

The *Regular Expressions* mode lets you perform batch renaming using regular expressions to specify search and replace patterns.

![](https://3597805814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3XSZSwWow0fDf6fQJobd%2Fuploads%2Fgit-blob-f52704b2b15ec9f10c375519ec639480f968b1b5%2Fregular_expression_rename.png?alt=media)

The example above shows a very simple regular expression that has been used to remove the underscore from the original filenames. The **Old name** pattern of *(.\*)\_(.\*)* uses parentheses to tag two "match anything" expressions, and the *\1\2* in the **New name** pattern inserts the values of the two tagged expressions in the new name.

An extension Directory Opus provides is the ability to perform a repeating search and replace using regular expressions. The above example will only remove a single underscore, but if you wanted to remove all underscores from the source name, you can append a # (pound/hash) sign to the **Old name** pattern. This causes Opus to repeat the search and replace until the new filename no longer changes.

See the [Regular Expression Syntax](https://chaoses-ib.gitbook.io/directory-opus/manual/reference/wildcard_reference/regular_expression_syntax) reference page for more information about using regular expressions. Additional information can be found in  [Microsoft's introduction to TR1 ECMAScript](http://msdn.microsoft.com/en-us/library/bb982727.aspx) (the flavor of regular expressions that Opus uses by default) for more information, and you can ask on the [Opus Resource Centre](http://resource.dopus.com/) if you need help.
