08-30-2023 11:48 AM - edited 08-30-2023 12:07 PM
With the help of ChatGPT, I was able to get this RegEx formula to extract the company domain from website field. The use case would be to update another field using the following formula -
RegExReplace(${Website}, "^(?:https?:\/\/)?(?:www\.)?([^\/]+)(\/.*)?$", "$1")
To extract the domain from the email, you can try this -
RegExReplace(${Email}, ".*@(.+)$", "$1")
And this may be useful to review contacts that don't have an email that matches the companies domain.
Good luck!
CC: @AnthonyValidity
Solved! Go to Solution.
08-30-2023 12:23 PM
I checked both versions, found the 1st option removes additional page references (...domain.com/aboutus).
RegExReplace(${Website}, "^(?:https?:\/\/)?(?:www\.)?([^\/]+)(\/.*)?$", "$1")
This version appears to appears to be a wild card replacement similar to removing "http*//*www*"
RegExReplace(${Website}, "^(?:https?:\/\/)?(?:www\.)?([^\/]+)", "$1")
@AnthonyValidity Thanks for the weekly call, and as I always pickup something useful.
08-30-2023 12:05 PM
This is great, @michael-wtds ! I Googled this one:
RegExMatch(${Website}, "[^(?:http:\/\/|www\.|https:\/\/)]([^\/]+)")
RegEx is awesome and there's usually more than one way to do the same thing!
Thanks for sharing,
08-30-2023 12:23 PM
I checked both versions, found the 1st option removes additional page references (...domain.com/aboutus).
RegExReplace(${Website}, "^(?:https?:\/\/)?(?:www\.)?([^\/]+)(\/.*)?$", "$1")
This version appears to appears to be a wild card replacement similar to removing "http*//*www*"
RegExReplace(${Website}, "^(?:https?:\/\/)?(?:www\.)?([^\/]+)", "$1")
@AnthonyValidity Thanks for the weekly call, and as I always pickup something useful.
08-30-2023 02:14 PM
Hey @michael-wtds ,
Thanks for testing and sharing! I'll send over the one you provided to Petya.
It is seriously my pleasure - you all add so much to the calls and really make it a lot of fun for me and the team. We appreciate your participation here and on Office Hours.
Hope you have a great rest of the week!
04-24-2024 06:27 AM
When I tried matching existing accounts by website using the domain comparison, I didn't get any matching results. But when I used the following RegEx matching type, it found all similar accounts -
^(?:https?:\/\/)?(?:www\.)?([^\/]+)(\/.*)?$
Get industry news, expert insights, strategies, and hot tips, served up fresh every week.
Visit the Validity blog