Queries on "Get Regex matches" in Robocorp - regex

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.

Related

How to use regexextract on an imported data?

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?

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,"/$","")

Error converting client characters into server’s?

I have textarea field where user copy/paste the text from word document. When user tried to save the form this error message was returned fromt he server:
Error converting characters into server's character set. Some character(s) could not be converted.
After looking carefully over the text that user entered in the field I found out which character is causing the issue. So when user copy/paste the text from the word document dash character is different/longer than standard dash. So the text looks like this:
Red – All devices muted/Do not disturb is enabled
I simply replaced the dash and text looked like this:
Red - All devices muted/Do not disturb is enabled
and I was able to save the form. I'm wondering what I can do to correct/prevent this kind of issues? I use ColdFusion 2018 on the back end in combination with Sybase database. If anyone have suggestions on how to fix this error please let me know.

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.

regex exclude hit if text contains a second string match

I am trying to search thru log files to see if any warnings have appeared so that I can warn in a Jenkins pipeline using Jenkins plug in "Text Finder".
However, I have a case where I do not want hits on the string "CRIT" int he logfile if the string also contains plms.
E.g.
I have the following text in the log file:
<CRIT> 23-Jun-2014::10:57:13.649 Upgrade committed
<CRIT> 23-Jun-2014::10:57:13.703 no registration found for callpoint plmsView/get_next of type=external
I am not interested in having a warning for the second line, so I have added the following regex to Text Finder in Jenkins:
WARN|ERROR|<ERR>|/^(?=<CRIT>)(?=^(?:(?!plms).)*$).*$/
This should get a hit on CRIT only if the string does not also contain plms, i.e the first line, but I do not get a hit on either line.
I got the code from here: Combine Regexp
Could someone please help me correct this? Thanks!
You should use something like this:
WARN|ERROR|<ERR>|<CRIT>(?!.*?no registration found)
Change the no registration found part to match the <CRIT> message you want to exclude.
This expression matches also for the line:
<INFO> User WARNER registered
so you should consider using something like:
^(WARN|ERROR|<ERR>|<CRIT>(?!.*?no registration found))
that matches only if the tokens are at the beginning of the line (change the tokens accordingly).
This should work for you:
^<CRIT>(.(?!plms))*$
Demo and explanation