Help with RegEx
Posted: Wed Oct 26, 2016 3:47 pm
I have found the following Regular Expression very useful to look for a URL in a long text string:
(ftp:\/\/|www\.|https?:\/\/){1}[a-zA-Z0-9u00a1-\uffff0-]{2,}\.[a-zA-Z0-9u00a1-\uffff0-]{2,}(\S*)
Used on the following text string:
<td bgcolor="white" style="padding:5px !important;” class=“”><a href="https://www.jotformeu.com/uploads/Terke ... /DEMO.xlsx" class="">DEMO.xlsx</a></td>
... it will return this:
https://www.jotformeu.com/uploads/Terke ... /DEMO.xlsx"
It works very well with variables in Switch. The only problem is the dobbelt quote at the end of the string, so I changed the RegEx to this:
(ftp:\/\/|www\.|https?:\/\/){1}[a-zA-Z0-9u00a1-\uffff0-]{2,}\.[a-zA-Z0-9u00a1-\uffff0-]{2,}(\S[^"]*)
... adding [^"] to Group 2
Checking this in different online RegEx evaluators, it works fine, but if I use it in Switch, it breaks everything and only returns this: *)"].
Could anybody tell me how to change the RegEx to exclude the dobbelt quote at the end of the URL, AND have it work in Switch?
(ftp:\/\/|www\.|https?:\/\/){1}[a-zA-Z0-9u00a1-\uffff0-]{2,}\.[a-zA-Z0-9u00a1-\uffff0-]{2,}(\S*)
Used on the following text string:
<td bgcolor="white" style="padding:5px !important;” class=“”><a href="https://www.jotformeu.com/uploads/Terke ... /DEMO.xlsx" class="">DEMO.xlsx</a></td>
... it will return this:
https://www.jotformeu.com/uploads/Terke ... /DEMO.xlsx"
It works very well with variables in Switch. The only problem is the dobbelt quote at the end of the string, so I changed the RegEx to this:
(ftp:\/\/|www\.|https?:\/\/){1}[a-zA-Z0-9u00a1-\uffff0-]{2,}\.[a-zA-Z0-9u00a1-\uffff0-]{2,}(\S[^"]*)
... adding [^"] to Group 2
Checking this in different online RegEx evaluators, it works fine, but if I use it in Switch, it breaks everything and only returns this: *)"].
Could anybody tell me how to change the RegEx to exclude the dobbelt quote at the end of the URL, AND have it work in Switch?