Remove WWW and HTTP / HTTPS with regular expression

0
Hello, I'm doing a script that inserts values inside a finance system, but when I enter it with 'www' 'http' 'https' gives error and I have to remove it in hand. So I want to put a regular expression that removes those values from the url before sending. The script is already sending, just like help to form the regular expression.

    
asked by anonymous 09.08.2018 / 21:31

1 answer

0

To remove www, http, and https, you must use replace as follows:

string.replace( /www|https?/ , '');

? indicates that s is optional whether or not it exists and if it exists it will be replaced.

The | is the conditional or

    
09.08.2018 / 21:54