15 Must-Know Regex Patterns for Bubble Workflows 🚀

Hello Bubble Enthusiasts!

Have you ever struggled with text inputs, validations, or dynamic extractions in your Bubble workflows? Regex (Regular Expressions) can be your best friend! Here’s a collection of regex patterns that are super handy for building smarter apps in Bubble. :fire:

1. Email Validation :e-mail:

  • Regex: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
  • Why it’s useful: Validate user emails during signups or in forms!
  • Example: example@bubble.io :heavy_check_mark:

2. Extract Numbers from Text :1234:

  • Regex: \d+
  • Why it’s useful: Perfect for pulling numbers out of mixed text fields (e.g., prices or IDs).
  • Example: From Order #12345, it extracts 12345.

3. Hashtag Detection :hash:

  • Regex: #\w+
  • Why it’s useful: Use this to find hashtags in user-generated content. Great for building social media-style apps.
  • Example: From #BubbleIsAwesome, it extracts #BubbleIsAwesome.

4. Phone Number Validation :phone:

  • Regex: ^\+?[1-9]\d{1,14}$
  • Why it’s useful: Ensures phone numbers are valid and in international format.
  • Example: +1234567890 :heavy_check_mark:

5. Password Strength Validation :closed_lock_with_key:

  • Regex: ^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
  • Why it’s useful: Build a custom signup form that enforces strong passwords.
  • Example: Matches Secure@123.

6. URL Validation :globe_with_meridians:

  • Regex: https?:\/\/(www\.)?[a-zA-Z0-9-]+\.[a-z]{2,}(\S*)?
  • Why it’s useful: Verify user-provided links in forms or inputs.
  • Example: Validates https://bubble.io.

7. Duplicate Word Detection :arrows_counterclockwise:

  • Regex: \b(\w+)\b\s+\b\1\b
  • Why it’s useful: Finds typos like “the the” in text.
  • Example: From This is is fun, it catches is is.

8. Extract Hex Color Codes :art:

  • Regex: #([a-fA-F0-9]{6}|[a-fA-F0-9]{3})
  • Why it’s useful: Handy for apps where users input color codes.
  • Example: Extracts #ffffff or #abc.

9. Validate Dates (YYYY-MM-DD) :date:

  • Regex: ^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$
  • Why it’s useful: Enforce proper date formats for input fields.
  • Example: Validates 2024-12-30.

10. File Name Extraction :open_file_folder:

  • Regex: ([^\/]+)$
  • Why it’s useful: Extracts just the file name from a file path.
  • Example: From /uploads/image.jpg, it gets image.jpg.

:rocket: How to Use These in Bubble:

  1. Add a Regex Pattern in a Workflow action or condition.
  2. Use these patterns in input validation, custom filtering, or extracting text.
  3. Bonus: Combine with Bubble’s “Extract with Regex” function for maximum power!

:speech_balloon: Let’s Discuss!
Which of these patterns do you find the most useful? Have you used regex in your Bubble projects before? Share your use cases or regex hacks below. Let’s inspire each other! :rocket::sparkles:

Cheers,
Abdullah

29 Likes

Thanks, @amer . That really helps!

1 Like

nice list thank you

1 Like

Very helpful! Thanks

1 Like

Thanks for taking the time to post that.

Also, if someone wants to build, test, or debug their regex they can use this:

3 Likes