What is a Regular Expression?
A Regular Expression (or Regex) is a sequence of characters that specifies a search pattern in text. It's a powerful tool used for finding, replacing, and validating strings.
Common Metacharacters
Character | Description |
. | Matches any single character except newline. |
\w | Matches any word character (alphanumeric & underscore). |
\d | Matches any digit (0-9). |
\s | Matches any whitespace character. |
[abc] | Matches a single character in the set (a, b, or c). |
( ) | Groups multiple tokens together and creates a capture group. |
* + ? | Quantifiers: 0 or more (*), 1 or more (+), 0 or 1 (?). |
^ $ | Anchors: Start of string (^) and end of string ($). |
What is Fuzzy Matching (Edit Distance)?
When "Exact Match" isn't enough, we can use "fuzzy" algorithms. This tool uses the Levenshtein distance, which measures the difference between two strings by counting the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one string into the other.
An edit distance of 1 means a string is just one character off. This is useful for correcting typos or finding very close matches, but it is not part of the standard Regex engine.