How to Extract a Custom URL Parameter in Google Data Studio? - regex

I am trying to track performance of a URL parameter using Google Data Studio. The URL looks like this:
https://example.com/?gclid=something&extension=me-trying-stuff
I want to get me-trying-stuff at the end of &extension.

&extension=([^\s&]*)
This regex will find &extension= in your url, and capture characters up to the next & (or whitespace).
Try it here!

Related

How can I get the specific part from the link using regular expressions (regex),,,

The format of Url is - https://example.com/items/html5-templates/654321
Firstly I want to take the link without last numbers.
e.g: https://example.com/items/html5-templates/
And,
Secondly, want to take only the last part (numbers) from the link.
e.g: 654321
I need to get the regex code for using in a auto Parse plugin to my wp site,,,
And then I can customise the link as
Like:
https://.....(link without last part)...../...anything..../...(only last numbers from the link format)...
Thanks a lot for your precious time,,,
use str.replace(/\/\d+$/, '') to remove /86886866 from string like https://www.wexperts.xyz/32423
The result will be like https://www.wexperts.xyz
Try something like this:
^(.*/)(\d+)$
The first part of URL will be in first capture group, and second capture group will be numbers.

Google Data Studio how to replace a string character by position?

I am new into Google Data Studio and I am trying to cleanse some Google Analytic data.
For example I have a filed called page which shows the page name. For some pages I have duplicates e.g: contact/product/car and contact/product/car/ (ending in this case with /)
I want to create a field that always replace the last charterer of the page name if it ends with '/' with a space
I have tried this function: REPLACE(ENDS_WITH(Page,"/"), '/','')
But is not working instead giving me true or false.
Someone can help me with this?
Please use regular expression for doing this job:
REGEXP_REPLACE(Page,"/$","")

Adapting Regular Expression in Django URL to match filepath

So I am currently working on a web application that takes as input the location of a malware file for one of the functions.
This is passed via the views file. However after some altering of the models section of the application I found it was unable to parse the full filepath.
The code below works for the following pcap as input:
8cdddcd3-35fa-468d-8647-816518a9836a435be1c6e904836ad65f97f3eac4cbe19ee7ba0da48178fc7f00206270469165.pcap
url(r'^analyse/(?P<pcap>[\w\-]+\.pcap)$', views.analyse, name='analyse'),
However this code no longer works when it is a pcap containing the full filepath.
/home/freddie/malwarepcaps/8cdddcd3-35fa-468d-8647-816518a9836a435be1c6e904836ad65f97f3eac4cbe19ee7ba0da48178fc7f00206270469165.pcap
Any suggestions or pointers on how exactly I would alter the regular expression to accomodate the full filepath in the string being passed to the route would be very much appreciated.
regex: ((/\w+?)+/)?([\w-]+\.pcap)
django regex: ^analyse(?P<pcap>((/\w+?)+/)?([\w-]+\.pcap))$
note that there is no slash after analyse because it's part of pcap now.
so analyse/home/freddie/malwarepcaps/foo-bar.pcap should match this pattern and pcap will be equal to /home/freddie/malwarepcaps/foo-bar.pcap
test:
https://pythex.org/?regex=((%2F%5Cw%2B%3F)%2B%2F)%3F(%5B%5Cw-%5D%2B%5C.pcap)&test_string=8cdddcd3-35fa-468d-8647-816518a9836a435be1c6e904836ad65f97f3eac4cbe19ee7ba0da48178fc7f00206270469165.pcap%20%0A%2Fhome%2Ffreddie%2Fmalwarepcaps%2F8cdddcd3-35fa-468d-8647-816518a9836a435be1c6e904836ad65f97f3eac4cbe19ee7ba0da48178fc7f00206270469165.pcap&ignorecase=0&multiline=0&dotall=0&verbose=0
PS: I think it's better to move such parameter (path - /home/f/m/f.pcap) into querystring (for GET request) or into http-body (for POST request)
so it will be easier to obtain param without url-matching

Google Structured Query Parameters Not Working For List Feed

Using this documentation for reference as well as url escaping certain characters, I have the following spreadsheet being read via Spreadsheet API and I'm trying to fetch specific rows only: https://docs.google.com/spreadsheets/d/1E5ROfSQAuQvqx7o61Au9eEd-6B7W35gfj3g7C6VhpGY/
If I try to filter by badgenumber I get zero results back
https://spreadsheets.google.com/feeds/list/1E5ROfSQAuQvqx7o61Au9eEd-6B7W35gfj3g7C6VhpGY/od6/public/values?sq=badgenumber%3D%2212345%22
<openSearch:totalResults>0</openSearch:totalResults>
sq=badgenumber="12345"
Your current parameter has double quotes. Try removing them. This query string worked for me:
?sq=badgenumber%3D12345
It also worked with the first and last name columns, which are clearly strings. So it seems like quotes are not required:
?sq=firstname%3DDan
?sq=lastname%3DKusanago

Yahoo Pipes Using Regex to change link

Hi I am pretty new to regex I can do some basic functions but having trouble with this. I need to change the link in the rss feed.
I have a url like this:
http://mysite.test/Search/PropDetail.aspx?id=38464&id=38464&listingid=129-2-6430678&searchID=250554873&ResultsType=SearchResult
and want to change it to updated site:
http://mysite.test/PropertyDetail/?id=38464&id=38464&listingid=129-2-6430678&searchID=250554873&ResultsType=SearchResult
Where only thing changed is from /Search/PropDetail.aspx
to /PropertyDetail/
I don't have access to the orginal rss feed or I would change it there so I have to use pipes. Please help, Thanks!
Use the regex control.
In it, specify the DOM address of the node containing your link (prefixed by "item.") within the "In" field. For the "replace" field type
(.*)//Search//PropDetail/.aspx
and in the "with" field type use:
$1//PropertyDetail//.*
I've 'escaped' the '/' character in the with field. However, I'm not sure you need to do this except before the '.*' Some trial and error may be needed.
Hopefully this will achieve the result you want.