Extract data with regex from variable not working

Hello people! I hope you can help me here.

I describe my case:

What I’m trying to achieve is to extract data from a string, stored in a variable, using regex.
What is important here is that it doesn’t work when I store the variable using “copy from clipboard” from the unix console. It does store the value in the variable but then we I apply a regex using a “assign” activity the outcome value is null.

The steps taken go like this:

1- In a Unix console I “copy all to clipboard” using Putty (Unix), it copies all the text from the screen.
2- I use the “Get from clipboard” activity to store the clipboard into a variable (CDR)

3- Message Box (CDR) in order to check if the variable stored the text taken from the clipboard (it does)

4- Assign activity to extract a piece of information from the variable (CDR) with regex, and store it into a variable (CategoryTax).
image

The regular expression is correct:

5- Message Box (CategoryTax) to see the value of the variable (It should be “263”). Result: Null, no value.
image

Example of the workflow:

Thanks in advance!
Andres

Hi @andres.enriquez ,

Could you also maybe check with the below Regex Expression once, we are just trying to check if the first part could be recognised correctly and then we can work on the Limiter.

(?<=categoryTax:).*

Also, Maybe try using the Expression in the Debug Panel and check it there or directly execute the Expression in a Message Box and check, as we also see that the two variables have different scopes CDR & CategoryTax.

The CDR has a value:

But still the regex doesn’t work:
image

I also changed the scoped of both variable, they are in the same.

But I found something weird, when I change the regex to “.*”
image

The result is:
image

and that is:

@andres.enriquez ,

Could you maybe check with the below Expression :

System.Text.RegularExpressions.Regex.Match(CDR,"(?<=categoryTax: ')(.*)(?=')",System.Text.RegularExpressions.RegexOptions.MultiLine).Value

Well, it seems that worked !
Thanks a lot @supermanPunch !!
Where should I learn these things? I checked the documentation available but haven’t found anything.

Are you aware that there are Terminal activities that are intended for use with mainframe systems, that you should be using rather than things like copy/paste?

Yes, I know, I tried but they didn’t work for me this time. Thanks.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.