Detecting emails, phone numbers, and links via "Extract with Regex"

Hey everyone,

I’m currently trying to detect emails, phone numbers, and links in a multiline input using Regex. Does anyone have great expressions/patterns to accomplish these? The catch is that the detected text will be in the same input as other random text, not by itself.

I’ve got an solid pattern for detecting emails: ([\w-]+(.[\w-]+)@([a-z0-9-]+(.[a-z0-9-]+)?.[a-z]{2,6}|(\d{1,3}.){3}\d{1,3})(:\d{4})?)

I’ve been using to find these patterns from their community but they don’t seem to be working unless the thing I’m detecting is the only text in the input.

I think solidifying these 3 patterns would be a huge benefit to a large group of Bubblers.

@fayewatson I saw you had a detailed (and quite entertaining) post dealing with Regex. Any ideas here?

Thanks everyone,


Ah! I think I know which post you’re referring to :joy: Glad to hear it was entertaining!

I’m not 100% sure but with a single multiline input, I think you would need to have three different expressions for emails, phone numbers and links. Are you saving the values which are extracted into separate fields?

For URLs, I currently use:

This works well! but I don’t think this would work if there isn’t an http or https at the start of the URL. Are you looking to extract links in the format of just “” as well?

I haven’t tested this for phone numbers thoroughly, but I think this extracts it correctly, for a number of different phone formats:
(?:+?(\d{1,3}))?[- (](\d{3})[- )](\d{3})[- ]*(\d{4})(?: *x(\d+))?\b

  1. I’m not saving the fields. I’m creating an approval system which detects when a user is typing something that they shouldn’t.

  2. The URL link worked! It would be ideal if I could also extract the non http/https format as well.

  3. The Phone Numbers one doesn’t seem to work when it’s by itself or with other text included.

No email/link/number
See how I’m testing below. When the email/link/number is detected, the text changes color:

Link inserted

Email inserted

Thanks for your help thus far!

1 Like

I just sent this tip out in a newsletter this past week! Here’s the pattern you want that will get all three below. You can see that they’re separated by a pipe character. It’s long but gets the job done.

[a-zA-Z0-9-.]+@[a-zA-Z0-9-.]+|(+?( |-|.)?\d{1,2}( |-|.)?)?((?\d{3})?|\d{3})( |-|.)?(\d{3}( |-|.)?\d{4})|[(http(s)?)://(www.)?a-zA-Z0-9@:%.+~#=]{2,256}.[a-z]{2,6}\b([-a-zA-Z0-9@:%+.~#?&//=]*)

Gaby | Coaching Bubble


Appreciate your input! It seems it didn’t work for email, url, or phone number regardless if it was the only text in the input or not.

It’s possible I didn’t trigger my conditional properly. I used the following:

57 PM


Hm, working for me unless I’m misunderstanding your goal. Your expression works as well as “Multiline’s value:extract with Regex:first item is not empty”

Check it out:




Hmm, I think I may have copy+pasted the wrong regex for phone validation previously! If anyone is looking for one just for phone numbers, this pattern seems to work:

(?:+?(\d{1,3}))?[- (](\d{3})[- )](\d{3})[- ]*(\d{4})(?: *x(\d+))?\b

@romanmg’s solution worked perfectly for me though! Thank you Gaby! :slight_smile:

I just tested with all formats (extracted text is in green):


I must have somehow copied it wrong. Works perfectly!!! You guys are the best!


How can i extract 4th from behind Malviya nagar in this case using regex or any other method.

B154, Block B, Shivalik Colony, Malviya Nagar, New Delhi, Delhi 110017, India

I want to take out this string from fourth from last to third from last , from various addresses.


Loved your regex for extracting URLs… but in my case the JSON I’m receiving contains 2 URLs… I just want the first one… How would your regex look like? can you help me?


Hi @scharan :slight_smile: using :first item after the :extract with Regex part of the expression should do the trick!


1 Like

This link is not working anymore…


Thanks for your input!

Somehow as I tested it now the Regex provided by you was not capturing phone and email inputs, although I was entering it into “Multiline’s value:extract with Regex:first item is not empty”. Does it still working for you?

For those who have the same issue, I want to share Regex that helps identifying phone numbers:

(?!:\A|\s)(?!(\d{1,6}\s+\D)|((\d{1,2}\s+){2,2}))(((+\d{1,3})|((+\d{1,3})))\s*)?((\d{1,6})|((\d{1,6})))/?(([ -.]?)\d{1,5}){1,5}((\s*(#|x|(ext)).?\s*)\d{1,5})?(?!:(\Z|\w|\b\s))

I tried this:
Multiline’s value:extract with Regex:first item is not empty
with the Regex:
(?!:\A|\s)(?!(\d{1,6}\s+\D)|((\d{1,2}\s+){2,2}))(((+\d{1,3})|((+\d{1,3})))\s*)?((\d{1,6})|((\d{1,6})))/?(([ -.]?)\d{1,5}){1,5}((\s*(#|x|(ext)).?\s*)\d{1,5})?(?!:(\Z|\w|\b\s))

It doesn’t work. Is there anything yet this i need or missing? I am new to bubble!