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,"/$","")
Related
I can't get my regexextract to work properly on google sheets.
I have imported data from one tab to another, like this:
=IMPORTRANGE("https://docs.google.com/spreadsheets/d/1o52z55YdNha4T_tCsKcHkrbA5sR4C1GyxYuBmMGGqu0/edit#gid=0"; "SheetName 1!A2:G103")
This works fine and what Im importing are percentages. Now, what I'm trying to do is to use regex to extract the numbers and omit the '%' symbol.
Normally I would type: =VALUE(REGEXEXTRACT(A11,"\D+"))but it doesn't work. However, if I use this exact Regex on any 'normal' cell (cell that is not an import from another tab), it works.
Is there a reasong regex doesn't work on an imported value?
Edit:
I have to send surveys to clients to know if they are satisfied with the provided service. Customers will choose between a few options. I do that using google forms by creating one form, and I link it to a google sheet where the answers from the form are pasted:
On the same sheet, I've added a tab where I import the data from the previous tab, by using importrange:
As you can see, it works. But I want to take out the letters and the '%' symbol. I just want the numbers so I can run an AVG function.
Is there a way to do that?
Thanks
You can try the following:
=REGEXEXTRACT(A11,"(\d+)")
Here is the sample input and output data using the previous function:
I think the problem is just related to the capital "D" since you need to use "d" instead.
You can check this other post as a reference:
What does \d+ mean in regular expression terms?
I have a form in MS Word which the user fills and emails me. I have to open the form and capture all the details entered by the user and use the same to submit a form in my portal.
I am trying to create a robot using Robocorp to automate this process. Using "Get All texts" - RPA Word library, I am logging the contents from the Word document in Robocorp and then trying to get the required data using Regex but need some help on extracting the data using Regex.
Please find the raw text logged in Robocorp below,
Source Text
Query 1:
Need to extract Manager name:
In Regex101, I am getting the name returned as expected upon using, [^Manager\n].*
In Robocorp, when I use 'Get regex matches' with [^Manager\n].*, I am getting all the content of the text file.
Please help me with the regex to use in Robocorp to extract the Manager name.
Query 2:
I need to extract the answers provided by the user for the questions in the above form. (Note: The answers change with every form submitted)
I tried the below,
For eg: I pulled one question first from the above form using - Get Regex matches (?s)(Lunch).*?(No).
I got the below value returned in robocorp,
['Lunch account required? \x07☒ Yes\r☐ No']
Now again from this value returned (using this as string), I tried to get the answer selected by the user using,
Get Regex matches (?<=☒)\s\w+
But I am getting the error "TypeError: expected string or bytes-like object".
Not sure, If the above flow is right or can I get the answers selected by the user for all questions in a different way?
Sorry if my questions are simple. I am totally new to using Regex and in my learning phase.
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!
I am trying to create a field in Google Data Studio that sums the revenue for lists that begin with US. I know I have to use regex, but it continue to tell me there is an unexpected end to the formula.
Here is the code.
Revenue WHERE REGEXP_MATCH(List, '^US')
Please let me know if you have any questions.
Thanks!
You can use
WHERE REGEXP_MATCH(List, '^US.*')
^^
Or even
WHERE REGEXP_MATCH(List, 'US.*')
See REGEXP_MATCH documentation:
REGEXP_MATCH attempts to match the entire string contained in field_expression. For example, if field_expression is "ABC123":
REGEXP_MATCH(field_expression, 'A') returns false.
REGEXP_MATCH(field_expression, 'A.*') returns true.
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