Find and Replace in Text
Advanced text manipulation tool with Regex support, case sensitivity, and step-by-step match approval. Safely search and edit large text blocks.
About
Mass text editing requires precision to avoid data corruption or unintended context shifts. A standard global replacement often fails when dealing with homonyms or variable formatting. For instance, replacing a variable name in code without checking boundaries might break the syntax. This workspace addresses the critical need for controlled text manipulation. It integrates Regular Expressions for pattern-based search and offers a verification layer. Users can audit matches individually before commitment. This prevents the classic "Scunthorpe problem" where broad filters inadvertently modify valid substrings.
Formulas
The core logic relies on pattern matching algorithms. In JavaScript (ECMAScript), Regular Expressions are objects that match patterns with character combinations. When the global flag g is active, the engine searches for all occurrences rather than stopping after the first match.
During a replacement operation with capturing groups, the string reconstruction can be visualized as mapping input segments to a new format using variables $1, $2, etc., representing the captured sub-expressions.
Reference Data
| Token | Description | Example Pattern | Matches Example |
|---|---|---|---|
| . | Any single character (except newline) | a.c | abc, a@c, a c |
| ^ | Start of string/line | ^Hello | Hello World |
| $ | End of string/line | end$ | The end |
| * | Zero or more repetitions | ab*c | ac, abc, abbc |
| + | One or more repetitions | ab+c | abc, abbc |
| ? | Zero or one repetition | colou?r | color, colour |
| \d | Any digit | user_\d+ | user_12, user_007 |
| \w | Word character (alphanumeric + underscore) | \w{3} | Car, 123, _id |
| \s | Whitespace character | key\sval | key val, key val |
| [] | Character Set | [aeiou] | a, e, i, o, u |
| [^] | Negated Set | [^0-9] | a, B, $ (No digits) |
| () | Capturing Group | (abc) | abc (Groups it) |
| | | Alternation (OR) | cat|dog | cat, dog |
| \ | Escape special character | \$100 | $100 |