Regular expression to filter URLs? - regex

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$

Related

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

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.*

regular expression : get super scripted text

I would like to get super scripted text via following html string.
testing to <sup>supers</sup>cript o<sup>n</sup>e
The result I would like to get is like below
supers
n
This is what I tried right now
But the result is not what I want.
<sup>supers
<sup>n
Could anyone give me suggestion please?
You can use lookbehind in your regex:
(?<=<sup>)[^<]*
Update Demo
Use this if there may be other HTML tags between <sup> and </sup>:
(?<=<sup>)(.*?)(?=<\/sup>)
Check the demo.
You were close, just not capturing your match:
Updated regex
(?:<sup>)([^<]*) I just added a capture group around your match
(?<=<sup>)([^<]*?)(?=<\/)
This should work.
See demo.
http://regex101.com/r/sA7pZ0/13

Regex help: get stream url from soundcloud

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

Get website regex from a website link

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.

Regular expression for URL for Google Analytics

I'm trying to set up a goal on Google Analytics and want to match a regular expression against the following url:
/tasks/[random characters of random length]/complete
An example input url would be:
/tasks/12444ab22aaa7/complete
Any ideas?
^/tasks/.*/complete$
Validate with a search in the Top Content report before using in a filter.
Perhaps this
\/tasks\/[^/]*\/complete