You are here: PSPad forum > English discussion forum > Problem Extract URL
Posted by: maki | Date: 2020-03-15 11:28 | IP: IP Logged
Problem Extract URL
^https?:\/\/(?www.)website\.ru/(\d+)/(\d+)/(\d+\-*)|avtor/+[A-Za-z0-9-]$
Must match:
website
www.website
website:
website:
website-
www.website
Edited 1 time(s). Last edit at 2020-03-15 11:28 by maki.
Posted by: pspad | Date: 2020-03-15 11:56 | IP: IP Logged
It won't match http, cause in your expression is https
Posted by: maki | Date: 2020-03-15 12:11 | IP: IP Logged
Ok but even without a protocol it doesn't work properly. Another part is the problem
Edited 1 time(s). Last edit at 2020-03-15 12:12 by maki.
Posted by: pspad | Date: 2020-03-15 12:26 | IP: IP Logged
You must include both protocols
Posted by: maki | Date: 2020-03-15 12:31 | IP: IP Logged
protocol ???
(https|http)|www\d{0,3}[.]
problem REGEX "(\-*)" Match:
XXX/XXX/XXX/XXX
XXX/XXX/XXX-XXX
X = NUMBER
Edited 2 time(s). Last edit at 2020-03-15 12:34 by maki.
Posted by: pspad | Date: 2020-03-15 12:35 | IP: IP Logged
It's not problem of regular expressions, but ptoblem of your expression.
I thought you must be expert already, but you have stil problems with reading your expression.
If you want to use any "tool", you need to understand it, not only copy/paste something and argue it doesn't work.
Posted by: maki | Date: 2020-03-15 12:40 | IP: IP Logged
The specific separation of valid addresses in this case will not work, because it will simply still extract with additional text.
Multiple links in a line are also invalid.
It doesn't need many domains.
Writing expressions with "|" it works, but it is unreasonable - I would like to simplify the expression as a single joint syntax.
I really don't need a protocol, just \.ru
Edited 5 time(s). Last edit at 2020-03-15 12:47 by maki.
Posted by: pspad | Date: 2020-03-15 12:48 | IP: IP Logged
What about this one:
^(http|https):\/\/[\.\w\-_\:]+(\/[\w\-_]+)+
It matches all your examples.
PS. There is no necessary to excape / char, so for better readability you can use:
^(http|https)://[\.\w\-_\:]+(/[\w\-_]+)+
Edited 1 time(s). Last edit at 2020-03-15 12:49 by pspad.
Posted by: maki | Date: 2020-03-15 12:50 | IP: IP Logged
Next part ???
\.ru/([^/]+)/([^/]+)/([^/]+)/(\d+-*\d+)
Posted by: pspad | Date: 2020-03-15 13:05 | IP: IP Logged
Why next part? All examples you provided match regular expression I sent in my previous answer.
But I guess you have other and other URLs what are totaly different from examples as always, right?
Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR