I have the following string:
"http://sprzedajemy.pl/http://soloch.sprzedajemy.pl/renault-scenic-i-grafitowy,10395187"
Now, I want to match everything after the second occurrence of "http://", which I tried like this without any success:
/(http:\/\/){2}(.+)/
What am I doing wrong?
You're quantifying the group http:// twice instead of skipping to the second occurence. Use this regular expression:
/^(?:http:\/\/(.+)){2}/
Here is a regex demo!
Try the below regex to match the string which was after just after to the second http://,
(?<=http:\/\/)(?:(?!http:\/\/).)*$
DEMO
If you want to capture the string then try the below,
(?<=http:\/\/)((?:(?!http:\/\/).)*)$
DEMO
http.*?http\:\/\/(.*)
This should do it.
See demo.
http://regex101.com/r/bZ9kJ0/1
(?!http.*?http.*)http\:\/\/(.*)
Use this to ignore https if its there in first position.
Related
The wildcards seem to only apply to non-string literals and text.
I want to match the text on a partial match.
Example:
source: org.*.application-* AND "*.pdf"
The wildcard works with the source param but not instead of my literal.
How can I use a wildcard inside a string to get back all that match that contains a log with
"XXXXXXXXXXXX.pdf"
Okay - it turns out you remove the quotes - Anytime you add quotes the whole word must match
so this turns out to be the equivalent of what I was asking for:
source: org.*.application-* AND *.pdf
I would like to find a regex formula that takes this URL
https://info.example.edu/programs/degree/page1/
and turns it into this
info.example.edu/programs/degree/page1/
I currently have this formula but it neglects the subdomain
=REGEXEXTRACT(A1,"(\..+)")
You could try this instead.
=REGEXEXTRACT(A1,"[^/]+//(.+)")
This captures anything after //
Output:
I'm trying to create a dynamic url pattern for the following url:
http://domain.com/content/pagetitle
This is what I have added in the url.rules:
'content/<page:.*?>' => 'cms/default/home',
this works fine for /content/pagetitle.html but not for /content/pagetitle while my url suffix is empty. Does anyone know what I'm doing wrong?
Your problem might also be that the regex "any character" character . gets escape if outside of a named group.
<controller:[a-zA-Z]>/(.*)
turns into
<controller:[a-zA-Z]>/(\.*)
// ^ It escaped it for us even though we didn't want it
The solution is simply to make group for it:
<controller:[a-zA-Z]>/<wildcard:.*>
Not sure why you are adding the .*? there...
The following example should work
'content/<page:.+>' => 'cms/default/home',
You do not need a wildcard in this case:
'content/<page>' => 'cms/default/home',
I am using oData protocol which add the filter criteria in the url
E.g. /api/restaurants/getall?$filter=substringof('macdonald',Name)
My problem when the value has apostrophe like (macdonald's) it will break the url
It works fine if I replace it with %26 like macdonald%26 but by adding s (macdonald%26s) the url will not work
any suggestions?
When inside the quoted string a single quote can be escaped by doubling it. So in your case it would look like 'macdonald''s'.
I see this is an old post, but I'll point out that the arguments in the substringof expression are switched.
https://help.nintex.com/en-us/insight/OData/HE_CON_ODATAQueryCheatSheet.htm
This is aside from the apostrophe (single quote) problem.
i have a string that maybe contains text with links.
I use these instructions for elaborate it:
message = message.gsub(/http[s]?:\/\/[^\s]+/) do |m|
replace_url(m)
end
if the string is "http://www.youtube.com/watch?v=6zToqLlM8ms&playnext_from=TL&videos=qpCvM5Ocr3M&feature=sub"
the instructions works.
but if the string is "hi my video is http://www.youtube.com/watch?v=6zToqLlM8ms&playnext_from=TL&videos=qpCvM5Ocr3M&feature=sub"
doesn't works
why?
how can i do?
thanks
Beucase this not match a pattern. Get before url add expression to catch some crap before url.
You can also try match a regex pattern to every word. Because url is always one word separated word.