Regex for this URL, http://www.chip.de and this domain chip.de - regex

I am trying to create a regex to look for similar URL and domain like this below
*chip.de
http://www.chip.de*
I tried to use the regex expression
http?:\/\/([\w\.-]+)([\/\w \.-]*)
It did not capture the URL.
I tried to use the url, https://www.regextester.com/99497 to test it out and it failed..
What am I missing?
Please create two rules for domain and URL
Thank you

If you're simply looking for regex that will match URLs which include chip.de then please try this and let me know if it is sufficient:
https?\:\/\/www\.chip\.de.*

Related

Replace characters in url by regex

I'm totally new to regex,
I'm using Yoast SEO - Redirects in wordpress, How to do that?
How to Replace "-and-" by "-" in url by regex
For example:
wwww.website.com/top-products-and-brands/product1/
To:
wwww.website.com/top-products-brands/product1/
I need to know what is the regex for match -and-
And how to redirect to the new link?
Thanks a lot.
Disclaimer: I have never used Yoast SEO
I think this will work:
Regular Expression:
(.*)(?:-and-)(.*)
New Url:
\$1-\$2
But honestly, I couldn't tell you because their docs on regex don't specify the syntax they use for capture groups, (or if they even support them at all).

Analytics - Match URL with Parameters

I am having difficulties registering this URL as a goal. It is the final URL.
https://foo.com/Home/Search?Message=Success&show=True
I have tried matching the exact URL, but that doesn't work. I've tried various regEx patterns, but I don't know how to match a specific parameter/value.
Any help would be very much appreciated.
Thank you.
To match exactly this URL your regex should be like :
https:\/\/foo.com\/Home\/Search\?Message=Success&show=True

WordPress URL Rewrite unable to get second matches

My URL is http://example.com/locate/ny/2
in functions, I use below code
$wp_rewrite->add_rule('locate/([^/]+)','index.php?page_id=294&cs=$matches[1]','top');
I got URL like this http://example.com/locate/ny I got this working, but i want to add a pagination after ny like ny?cpaged=3 and rewrite to ny/3
but what is the regexp for index.php?page_id=294&cs=$matches[1]&cpaged=$matches[2] from url http://example.com/locate/ny/2
You need to add another capturing group within the regex that just picks out the digits from the url. Assuming your url structure isn't going to change this regex should work.
$wp_rewrite->add_rule('locate\/([^\/]+)\/(\d*)','index.php?page_id=294&cs=$matches[1]&cpaged=$matches[2]','top');
See here for a demo and to play around with it further: https://regex101.com/r/BNkZBo/1/

Fiddler regex to replace url

I'm trying to find and replace urls with fiddler.
Example urls:
helpful.ninja/admin/js/1/1.js
helpful.ninja/admin/css/1/1/1.css
Now I would want the regex to grab any folder structure behind the admin/ and replace the url like:
dev.helpful.ninja/admin/
So the output should look like:
dev.helpful.ninja/admin/css/1/1/1.css and
dev.helpful.ninja/admin/js/1/1.js
I tried something like
regex:^http\:\/\/www\.helpful\.ninja\/admin\/((.+)\.(xml|json|js|css|png|jpeg|jpg|gif|jhtml))$
and to replace it with
http://dev.helpful.ninja/admin/$1
Sadly it won't work out does any have a idea what i'm doing wrong?
Use the following RegEx:
^http:\/\/www\.helpful\.ninja\/admin\/(.+\.(xml|json|js|css|png|jpeg|jpg|gif|jhtml))$
Check out This Demo

Regex to find keywords in URL

I am trying to write a Regex to detect specific keywords in a URL. For example I am looking for the word "update" in a URL and it could be as part of the domain or subdomain like these:
myupdate.example.com
www.my-update.com
I tried this but only get subdomains that start with "update":
http\:\/\/\bupdate\b
Any help would be appreciated!
/http:\/\/[^\/]*update/