A regular expression, also called a regex, is a method for matching text with patterns. A regex is created with specific syntax. If you are new to this topic, first refer to the following Microsoft guides: .NET regular expressions and Regular Expression Language - Quick Reference
With the Regex Tools add-in, you can use regular expressions in Excel to identify cells that match a certain condition or to extract, remove, or replace strings that match a regular expression.
Before getting started, take the following points into consideration:
To start, on the Ablebits Data tab, find the Text group and click on the Regex Tools icon:
On the left, you'll see the Regex Tools pane:
For example, on the screenshot above, we have a range with cells some of which contain telephone numbers that we need to extract. For the telephone number pattern "nnn-nnn-nnnn", the regular expression will be the following:
(\d{3}-\d{3}-\d{4})
If you tick Match and then click the Match button, the tool will check whether each cell in the column contains text that matches the expression you entered into the Regex box. TRUE means that it does, FALSE—that it doesn't:
If you select the Insert as a formula option, the result will be created with the custom AblebitsRegexMatch function.
Tick Extract to get the string that matches the regular expression extracted:
If you select the Insert as a formula option, the result will be created with the custom AblebitsRegexExtract function.
Select Remove to find and delete text that matches the regular expression:
If you select the Insert as a formula option, the result will be created with the custom AblebitsRegexRemove function.
Pick Replace and enter the value that should appear instead of the string that matches the regular expression:
If you select the Insert as a formula option, the result will be created with the custom AblebitsRegexReplace function.