Parse a text with regex
The Parse a text with regex helper lets users extract information from text using regular expressions (regex).
What is regex?
Regular expressions (regex) are patterns used to match character combinations in strings, enabling advanced search, replace, and text parsing capabilities for precise and efficient text processing in programming and data analysis.
Common use-cases
Data extraction: Extract specific patterns such as phone numbers, email addresses, or IDs from large text bodies.
Data validation: Check if text inputs adhere to expected formats, like verifying email formats or date structures.
Step-by-step instructions
Search regex pattern: Enter the regex pattern you wish to match against the text. This pattern defines the structure of the information you're aiming to extract or manipulate.
Text to search in: Provide the text or data you want to parse using the regex pattern.
Match new lines?: Enable if you want the dot (
.) in your regex pattern to match newline characters. This is false by default.Multi-line?: The "Multi-line" option is off by default. When enabled, it allows the start (
^) and end ($) symbols in your regex pattern to match the beginning and end of each line, rather than the whole text. Without this option,^and$only match the start and end of the entire text.Case insensitive?: Switch this on to make your regex search case-insensitive, broadening the match criteria without regard to letter casing. The search is case-sensitive by default.
Example - Data extraction
Let's say you need to extract email addresses from a block of text.
The step's input fields are:
Regex search pattern:
\\\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\\.[A-Z|a-z]{2,}\\\\bText to search in: Please contact John Doe at john.doe@example.com or Jane Smith at jane.smith@example.net for more information.
Case insensitive?: Enabled (to capture email addresses regardless of case)
Output:
Last updated