What is regex? And how to use it without code


The premise behind regex is fascinating: it lets you extract data from complex data sources using patterns, making that data more portable and useful.

But when I first learned about it, I wasn’t confident in my ability to write the code needed to make it happen. The fact that it relies on the careful and exact use of characters to get the specific information you need was more than a little intimidating for a non-coder.

But by establishing a foundation of knowledge, using built-in Zapier functionality, and plugging in AI assistants whenever I get stuck, regex has become a lot more accessible and useful across my work. Here’s how you can make it work for you too.

Table of contents:

What is regex?

Regex (short for regular expression) is an instruction for finding patterns in text.

For example, if you were looking for all the email addresses in a document, you might search for @. Regex is just like this, just that you’re giving specific instructions to help the computer understand what the target text looks like. When you’re looking for data at scale, this is a lot more fun than Ctrl + F.

You can use regex to extract important details from emails, web pages, or any kind of text-based data source. For example, you could use regex to:

  • Find anything that looks like a phone number

  • Get every name that follows the text “Customer:”

  • Pull out all dollar amounts from an invoice

The power of regex is in both its flexibility and control. Say you have a long document and you want to extract phone numbers from it. By manually entering numbers, you might also encounter instances of page numbers or other irrelevant pieces of information. With regex, you can define that you’re looking for phone numbers in the format of 10 digits (123-456-7890).

I’m most familiar with using regex in Python, but it also works in multiple other coding languages, including but not limited to JavaScript, PHP, C++, and Ruby. Or, if you want to get the best of regex pattern matching without diving deep into the syntax, Zapier offers built-in text parsing features that use regex principles behind the scenes, making it accessible even if you’re not confident writing the expressions yourself.

The basics: Understanding regex patterns

Regex patterns are built from small components that combine to describe specific text structures. Here are some of the basic components.

Category

Symbol

Meaning

Character classes

\d

Matches any digit (0–9)

\w

Matches any word character (letter, digit, underscore)

\s

Matches any whitespace (space, tab, newline)

.

Matches any single character (except newline)

Quantifiers

+

One or more of the previous character(s)

*

Zero or more of the previous character

?

Zero or one of the previous character

{3}

Exactly 3 of the previous characters

{2,5}

Between 2 and 5 of the previous character

Grouping and position

( )

Groups characters together, treats them as a single unit

[abc]

Matches any one character inside the brackets (e.g., a, b, or c)

^

Matches the start of a line

$

Matches the end of a line

With these building blocks, you can create powerful patterns. For example:

  • \w+ can match any complete word like “Bee,” “Zapier,” or “Constantine”

  • \d{3}-\d{3}-\d{4} matches phone numbers like 123-456-7890

  • [A-Z]\w+ matches words that start with a capital letter like “John,” but it won’t match “john”

  • \$\d+ matches dollar amounts like $50 or $1,000

While it’s a bit advanced, you might also see patterns like (?:Mr\.|Ms\.).

  • ?: makes it a non-capturing group. In other words, the computer uses this grouped pattern to match the text, but it doesn’t store it separately.

  • | is used for “or.” So this pattern could be used while matching Mr. John or Ms. Aleen.

Practical regex patterns you can start using

Any AI chatbot can help you develop your regex patterns, but here are a few themes and examples you can use for inspiration.

Category

Pattern

Description / Example

Name extraction

[A-Z][a-z]+\s+[A-Z][a-z]+

Basic two-part names (e.g., John Smith)

[A-Z][a-z]+(?:[-'\s][A-Z][a-z]+)*

Complex names (e.g., Jean-Paul, Jack O'Connor)

(?:Dr\.|Mr\.|Ms\.)?\s*([A-Z][a-z]+)\s+([A-Z][a-z]+) 

Names with titles (e.g., Dr. Sarah Johnson)

Business data

Invoice-?\d{4,6}

Invoice numbers (e.g., Invoice-12345, Invoice12345)

#?\d{5,8}

Order IDs (e.g., #123456, 123456)

[A-Z]{2,3}-?\d{3,4}

Product codes (e.g., ABC-123, XY1234)

Multiple instances

https?://[^\s]+

Matches all URLs (http and https)

\(?[\d\-\.\(\)]{10,}\)?

Phone numbers (flexible formatting)

[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}

Email addresses

Competitive analysis

`$\d+(?:.\d{2})?(?:/month/year)?`

Pricing (e.g., $29.99/month or $199/year)

<h[1-6][^>]*>([^<]+)</h[1-6]>

Plan names in HTML headings (extracts from <h1><h6>)

<li[^>]*>([^<]+)</li>

Extracts features from <li> elements

Advanced patterns

(?<=Order Total:)(.*?)(?=Shipping:)

Extracts text between Order Total: and Shipping:

Product_id:\s*([^\s\n]+)

Extracts the product ID following the label Product_id:

[$£€]\d+(?:,\d{3})*(?:\.\d+)?

Matches currency formats in $, £, (e.g., $1,200.00)

Automate regex with Zapier Formatter

You don’t really need to write scripts from scratch or tinker with APIs for extracting data. Zapier connects with 8,000+ apps, and with Formatter by Zapier, you can get the benefits of regex in a visual, no-code interface.

A screenshot of a window in the Zap editor with the Transform field set to Extract Email Address and no value chosen in the Input field.

Formatter includes options to extract email addresses, URLs, phone numbers, and numbers. It can find those items from your text and then automatically store them somewhere (or even transform them into something else).

For complicated data extraction, you can choose Extract Pattern in Formatter by Zapier and actually enter a regex pattern to find specific data you’re looking for.

Configuring a regex step in Zapier Formatter

Zapier also offers several options to fine-tune your results:

  • Match All: Returns multiple results as line items instead of just the first match

  • MULTILINE: Allows patterns to work across multiple lines of text

  • DOTALL: Lets the dot (.) character match across line breaks

  • IGNORECASE: Makes patterns case-insensitive

You can also use clear labels, such as named capture syntax like (?P<firstname>\w+), to organize the extracted data.

Automate advanced regex tasks with Code by Zapier

Zapier’s Formatter gets the job done in most cases. But if you need more complex functionality, you can also use code inside your Zapier pipeline to automate your workflow.

You can use Code by Zapier to:

  • Combine multiple regex patterns with conditional logic

  • Process large text blocks with complex extraction rules

  • Create custom validation and data cleaning workflows

For example, you could use it to extract competitor pricing data, clean and standardize the format, and compare it to your pricing. Based on the results, you could then trigger different automation paths to send you an email, Slack message, or even adjust pricing dynamically.

And with Zapier’s AI Copilot, you don’t even need to be a coder to make it happen.

Learning resources

This guide just scratches the surface when it comes to understanding regex. Here are some of my favorite resources for learning more.

Related reading:

Leave a Reply

Your email address will not be published. Required fields are marked *