It is currently March 29th, 2024, 10:10 am

regexp url filter

Get help with creating, editing & fixing problems with skins
User avatar
AnimaliX
Posts: 33
Joined: August 22nd, 2016, 9:22 pm

regexp url filter

Post by AnimaliX »

hello.
I trying simple regexp for filtering urls name... it must match http/https with or without "www."

I have this

Code: Select all

(?siU)<link>https?://(.*)\.
which working good.. for http and https, but not with www

example:

Code: Select all

http://www.abc.com, https://www.abc.com, http://abc.com, https://abc.com
all common url variants and I need with result = "abc"

anyone? thanks :)
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: regexp url filter

Post by FreeRaider »

Try this

Code: Select all

(?siU)\W{1,3}+([^www].*)\.\w{2,3}+
User avatar
AnimaliX
Posts: 33
Joined: August 22nd, 2016, 9:22 pm

Re: regexp url filter

Post by AnimaliX »

thanks, but where to put it?

Code: Select all

(?siU)<link>https?://\W{1,3}+([^www].*)\.\w{2,3}+(.*)\.
I trying webparsing from rss therefore "<link>"

sorry regexp is not my "forte" :)
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: regexp url filter

Post by FreeRaider »

Try this

Code: Select all

(?siU)<link>.*\W{1,3}+([^www].*)\.\w{2,3}+(.*)\.
User avatar
AnimaliX
Posts: 33
Joined: August 22nd, 2016, 9:22 pm

Re: regexp url filter

Post by AnimaliX »

Yah this works, thanks

it's completely different format from what I imagined :P
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: regexp url filter

Post by FreeRaider »

Glad to help!