How do I extract everything but the URL protocol (https://) using REGEXEXTRACT? - google-sheets

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:

Related

How can i trim URLs to root domain? i'm using notepad++

I have a list of domain name with parameters
http://www.anandinfra.net/project.php?id=2
http://artlinkinteriors.com/page.php?id=1
http://www.rabinmukherjeecollege.in/notice_details.php?id=1
I need to find other parts with domain and I have to replace those parts.
Finally my result should look as follows. Expected result:
http://www.anandinfra.net/
http://artlinkinteriors.com/
http://www.rabinmukherjeecollege.in/
How can I attain this result?
Hi you can create a CNAME in the DNS setting with the
http://www.anandinfra.net/project.php?id=2 pointing to http://www.anandinfra.net/
and same for the rest
In whatever programming language you use (which you don't disclose), find the relevant library handling URLs and use it to mutate them. DO NOT attempt to do that by string manipulation.

JMeter Extract Redirected Request Body URL

GET https://www.example/a/resource1?id=24 - I have this URL
This gets redirected to https://www.example/a/resource1-New-York - I need this URL -- This is how it looks like in the View Tree
I have tried extracting using the Extractor but doesn't work
This is how looks like in the Extractor
I get Not Found in the variable
You don't need the GET prefix, get all URL with
(.*)
Or without http://
http://(.*)
To solve the problem use Regular Expression Extractor and remove GET Protocol. Example is given below:

Slack slash commands - Variable/Parameters

I'm integrating slack with jenkins to use slash commands and want to know if slash commands have variables
What I want to do is something like this;
/this_word_should_be_in_the_url word
and the be able to use word in the URL the slash command will call.
On their page they have something like /weather 94070
Do I have access to the 94070 and somehow set is as a query parameter for the URL.
Is this possible?
Can't find any documentation of this.
Thanks.
Yes. You will have access to the word as per the example that you mentioned.
So for example, if you have the following:
/this_word_should_be_in_the_url word
Then there will be an additional query parameter named text that will contain everything else after the slash command. If you just have one parameter then it should be simple to just trim and use the text query parameter but if you have multiple words and need to split them into something more meaningful, then you might have to use some regex or simple string split function.
It is documented at How do commands work. In this section they have provided the various query parameters that will get passed to your Slash Command External URL. For the weather example, the data posted as per the documentation is:
token=gIkuvaNzQIHg97ATvDxqgjtO
team_id=T0001
team_domain=example
channel_id=C2147483705
channel_name=test
user_id=U2147483697
user_name=Steve
command=/weather
text=94070
response_url=https://hooks.slack.com/commands/1234/5678
Notice the text parameter in the above list.

Regex - Match everything after second occurence

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.

Apostrophe issue in url with OData

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.

Resources