Hi,
Need help in removing http:// and https:// in a website and add www. if it does have www. after removing http:// or https://, please samples below:
Raw Data:
Output:
Thanks,
Jaime
Solved! Go to Solution.
Hi @jatienza
One way of doing this
REGEX_Replace([Field1], '(https{0,1}:\/\/)(www){0,1}\.{0,1}', 'www.')
Hi @jatienza
Try something like this. The regex replace keeps everything after the slash. It also uses a contains function to determine if www needs to be added.
Thanks @Felipe_Ribeir0, it's working..
@jatienza Nice problem! RegEx to the rescue 😂. Solution using an optional non-capturing group! I only learnt about them last week, very useful things.
To explain what it's doing: .*\/{2}(?:www\.)?
.*\/{2} means: any characters followed by exactly 2 forward slashes. Foward slash is a special character, you must escape it using: \/ (backslash)
(?:www\.)? means: an optional group. I.e. some strings may contain it, some strings may not. But if they do, please recognise it. i.e. optional non-capturing so that we can replace it.
Everything together: .*\/{2}(?:www\.)? if you find this match in the string, replace it with: www.