I'm using this expression \"streamUrl":"([^]+)\?s to get the soundcloud stram url.
This is the output from RegExr: "streamUrl":"http://media.soundcloud.com/stream/NKV9VhgN31Jt?s
I need only the url (http://media.soundcloud.com/stream/NKV9VhgN31Jt?s) without "streamUrl":".
Use look behind assertion:
(?<="streamUrl":").+\?s
Demo
You can use preg_replace or simply use something like substr($url,strpos($url,"http"));
use this
http:[^\"]+
this will select the http url part only
demo here : http://regex101.com/r/zG3lD6
Related
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.*
I am trying to setup a htaccess redirect, but I need some help with the writing regex expression. Here s what I am trying to get to:
Before: example.com/[wildcard1]/9-3/[wildcard2]/ref/[wildcard3]/[wildcard4]
After: example.com/[wildcard1]/wis/9-3/[wildcard2]/ref/[wildcard3]/[wildcard4]
Try Regex: ^([^\/]+)(\/9-3\/[^\/]+\/ref\/[^\/]+\/.+)$
Demo
I am trying to write a regular expression in which I want to compare the URL's.
Any URL Matches
http://*.xyz.com
Except or Excluding
http://m.xyz.com and http://m.product.xyz.com
So far I was trying to do it by using if else in RegExp but I couldn't be able to do it right...
(^http:\/\/)(((1)<!(m|m\.product))\.xyz\.co\.jp)?
You can try that:
^http:\/\/(?!m\.xyz\.com|m\.product\.xyz\.com).*\.xyz\.com$
Regex101 Demo
https?:\/\/(?!m\.|m\.product\.).*\.xyz\..*
This regex accepts all *.xyz.* domains except m.xyz.* and m.product.xyz.*. Also takes care of http or https.
Demo
I need to filter some specific URLs using Regex in Google analytics.
It should only filter the below format URLs from the all URLs recorded:
/job/41-content-verification?action=register
/job/62-data-verification?action=register
/job/33-data-entry?action=register
Like starts with '/job/' then 'some string/data' and ends with '?action=register'
I need the regex to be put in Google analytics filter. Please help.
Try this:
^/job/.+?\?action=register$
^\/job\/.+?action=register$
Try this.See demo.
http://regex101.com/r/sU3fA2/24
^\/job\/[a-z0-9-]+\?action=register$
if I have a website like: www.google.com/en/my-page/anotherpage
how is it possible that with reg-ex to get: /en/my-page ? I am using this reg-ex in the IIS?
So far I have done something similar to this:
^(?:\\.|[^/\\])*/((?:\\.|[^/\\])*)/
but it is returning /en/my-page/ and I want it to return /en/my-page
In grep your regex is returning the string "www.google.com/en/". You can simply use the following regex if positive look behind is not mandatory :
(/[^/]+)+
You could use a look-ahead assertion to get rid of the last slash:
/\/.*(?=\/)/
This one should suit your needs:
^[^/]+(/.*)/[^/]+$
Visualization by Debuggex.
The output your looking for is in the first captured group.
Demo on RegExr.