In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Remove http:// and https:// in a Website URL

jatienza
8 - Asteroid

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:

http://www.sm.com

https://www.tracker.com

http://uncle.com

https://foryou.com

 

 

Output:

www.sm.com

www.tracker.com

www.uncle.com

www.foryou.com

 

 

Thanks,

Jaime

5 REPLIES 5
Felipe_Ribeir0
16 - Nebula

Hi @jatienza 

 

One way of doing this

 

REGEX_Replace([Field1], '(https{0,1}:\/\/)(www){0,1}\.{0,1}', 'www.')

 

Felipe_Ribeir0_0-1675375506501.png

 

binu_acs
21 - Polaris

@jatienza One way of doing this

 

binuacs_0-1675375607359.png

 

Luke_C
17 - Castor
17 - Castor

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.

Luke_C_0-1675375632790.png

 

 

jatienza
8 - Asteroid

Thanks @Felipe_Ribeir0, it's working..

BS_THE_ANALYST
15 - Aurora
15 - Aurora

@jatienza Nice problem! RegEx to the rescue 😂. Solution using an optional non-capturing group! I only learnt about them last week, very useful things.

BS_THE_ANALYST_0-1675378832926.png

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.

All the best,
BS

LinkedIN

Bulien
Labels
Top Solution Authors