ZeroWork
  • 👋Home and Welcome
  • 🚀Getting Started
  • ⬇️Install the Agent
  • 🧑‍💻Crash Course
  • Using ZeroWork
    • 🖥️General: Run, Schedule, Share, Webhooks
      • Run
      • Stop
      • Log in to the Agent
      • Run Modes
        • Run Incognito
        • Run Non-Incognito
        • Run in My Regular Browser
      • Run Settings
        • Run in Background
        • Stay on Page after Run
        • Bring Pages to Front
      • TaskBot Sharing Options
      • Cookies
      • Scheduler
      • Trigger Run via Webhook
      • Proxies
      • Remote (Cloud) Execution
      • How to Check and Update Your Agent
      • Install ZeroWork Agent on VPS
    • 📔Using Selectors
      • What Are Selectors
      • Use Element's Text
      • Copy Selectors
      • How to Build Custom Selectors
        • Basic Concepts of Selectors
        • One Element Can Have Many Selector Expressions
        • Check if Selector Is Correct and Unique
        • Exact or Loose Match
        • Hierarchy
        • Combine Filters with Standard CSS Logic
        • Lists: Incremental CSS Selectors
        • Addressing Siblings
      • How to Use XPath in ZeroWork (advanced)
    • 🏗️Using Building Blocks
      • Open Link
      • Save Page Url
      • Switch or Close Tab
      • Go Back or Forward
      • Switch Frame
      • Browser Alert
      • Click Web Element
      • Check Web Element
      • Save Web Element
        • Save Lists
        • Enrich Existing Data
        • Stop Run If Selector Is Not Found Option
      • Insert Text or Data
      • Hover Web Element
      • Select Web Dropdown
      • Keyboard Action
      • Start Condition and Set Condition
        • Actions = & ≠
        • Actions <, ≤, >, ≥
        • Data Found & Data not Found
        • Contains & Does Not Contain
        • Before (Date) & After (Date)
      • Start Repeat
        • Standard Loop
        • Dynamic Loop
        • Continue until No Element Is Found
        • Auto-Scroll
        • Auto-Continue from Last Row or Element
        • Nested Loops - Handle Pagination
      • After Repeat
      • Break Repeat
      • Try-Catch
      • Raise Error
      • Abort Run
      • Update Data
      • Number Operations
        • Example: Standardize different formats
      • Format Data
        • Remove Words
        • Shorten Content Length
      • Split Data
      • Apply Regex
      • Remove Duplicates
      • Delete Data
      • Ask ChatGPT
      • Send Notification
      • APIs: Send HTTP Request
      • Write JavaScript
      • Save File
      • Upload File
      • Delay
      • Record Date
      • Take Screenshot
      • Save from Clipboard
      • Log
      • Building Block Options
        • Delay Times between the Building Blocks
        • Randomize Delay Time
        • Deactivate Building Blocks
        • Shortcuts
        • Spintax
        • Auto-Align
        • Sticky Notes
    • 🔀Using Variables
    • 💿Using Tables
      • How to Add Tables
      • Native Tables
      • Google Sheets
      • Import Data from CSV
      • Using Google Sheet vs. Native Tables
      • Create Columns
      • Export Data as CSV
      • Convert Native Table to a Google Sheet
    • 📄Using Run Reports
    • 😑Common Problems
      • My TaskBot Does Not Start Run
      • When I Use Data from Table, No Data is Being Pulled
      • Website is Glitching and Flashing
      • No Selector is Found
      • My TaskBot Saves Some Data but Not All
      • Data Is Saved in Wrong Format
      • Website Requires SMS or Email Verification
      • Keyboard Action Is Not Working As Expected
      • Check Web Element Identifies Selector as Found but Next Action Does Not
      • When Using Insert Data Block, First Letters Are Cut Off
      • Workflow Has More than One Starting Building Block
      • TaskBot Does Not Automatically Scroll
  • Support
    • 🆘Getting Support
  • 🆕Release Notes
    • Version 1.1.61
    • Version 1.1.62
    • Version 1.1.63
    • Version 1.1.64
    • Version 1.1.65
    • Version 1.1.66
    • Version 1.1.67
    • Version 1.1.68
Powered by GitBook
On this page
  • Methods
  • Flags
  • Use Case Example: Extract Google Sheet IDs
  • Additional Notes
  • FAQ

Was this helpful?

  1. Using ZeroWork
  2. Using Building Blocks

Apply Regex

The Apply Regex building block allows you to perform advanced text formatting and manipulation using regular expressions.

Methods

  1. Replace text Replaces text matching the given regular expression with a replacement value.

    • Example 1: Replace the first occurrence of "birds" with "dogs": Input Text: "cats eat birds and birds fly" Regex: /birds/ Replacement: "dogs" Result: "cats eat dogs and birds fly"

    • Example 2: Replace all occurrences of "birds" with "dogs" (using g): Input Text: "cats eat birds and birds fly" Regex: /birds/g Result: "cats eat dogs and dogs fly"

  2. Extract matches Extracts text that matches the given regular expression.

    • Example 1: Extract the first match of a number: Input Text: "Number 123 and there is also another one 345" Regex: /\d+/ Result: "123" (Note: without "g", only the first number is extracted.)

    • Example 2: Extract all matches of all numbers (using g): Input Text: "Number 123 and there is also another one 345" Regex: /\d+/g Result: ["123", "345"]

  3. Check if pattern matches Checks if the text contains a match for the given regular expression and returns true or false.

    • Example: Check if "abc" exists in "abc123": Regex: /abc/ Result: "true"

Flags

You can add flags to modify the behavior of your regular expressions.

Examples of typically used flags:

  • g: Global search (matches all occurrences).

  • i: Case-insensitive search.

  • m: Multiline search.

  • Example: /example/gi performs a global, case-insensitive search.

Use Case Example: Extract Google Sheet IDs

Imagine you have a list of Google Sheets links and need to extract the IDs.

  • Your building block set-up:

  • Result: Extracted ID is "1aBcD_12345_EfGhI67-JklMnOpqrstu890".

Additional Notes

  • If the input text is empty, the TaskBot will take no action and continue running.

  • If your regex is invalid, the TaskBot will generate an error report and stop run/loop.

FAQ

I'm not a developer, can I still use regex?

PreviousSplit DataNextRemove Duplicates

Last updated 1 month ago

Was this helpful?

You can validate and test your regex using tools like .

Absolutely! Regex is simply a sequence of characters that specifies a match pattern in text. Anyone can use it. There are many reference guides on the internet to learn more. Here is one example: .

🏗️
regex101.com
Regex reference guide