From this expression ,
[{"controlNumber":"TEST082820230838038145467288"}
I want only TEST082820230838038145467288
Kindly help me with the regex pattern.
From this expression ,
[{"controlNumber":"TEST082820230838038145467288"}
I want only TEST082820230838038145467288
Kindly help me with the regex pattern.
system.text.regularexpression.regex.match(inputstr,“(?<=:.*)\w+”).value
or you can use below
hope this helps
Input= "[{"controlNumber":"TEST082820230838038145467288"}"
Output= System.Text.RegularExpressions.Regex.Match(Input,"[A-Z]+\d+").Value
Both variables are of DataType System.String.
Hope it helps!!
the string looks like a JSON string. If so, we would recommend to handle it with JSON related approaches and options instead with Regex
I agree with Peter, It might be a more future proof solution for you to use the Deserialize JSON activity @Ragavi_Rajasekar
That way you can pull any other values in and reference them as needed.
I am getting the json output from http request as this .
{
“message”: "{"acdvReqResponse":{"transactionId":"7E34B91A1697168556724","message":{"id":"SUCCESS","value":"ACDV Case Results have been retrieved"},"acdvReqs":[{"controlNumber":"TEST082820230838038145467288"},{"controlNumber":"TEST082820230838038145468288"},
Multiple control numbers are coming . For each is not working after deserialisation.
Hi @Ragavi_Rajasekar ,
You can use different regex patterns like:
If you want text preceded with “controlNumber” field then you can use:
(?<=controlNumber":")[a-zA-Z0-9]+
If you want text including TEST and followed digits, you can use:
TEST\w+ or TEST\d+ if they are digits always.
try this :
input_string = [{“controlNumber”:“TEST082820230838038145467288”}
`
System.Text.RegularExpressions.Regex.Match(Input_string,“[A-Z]+\d+”).Value
`
cheers…!
Unfortunately, we cannot refer to the entire JSON. Maybe you can share as text file
Maybe this also causes
Option A: (no serialized string)
Option B: (serialized string)
Hi @Ragavi_Rajasekar ,
Thanks for reaching out to UiPath community.
Here is the regex pattern you can use for extracting the desired text.
“controlNumber”:“(.*?)”
Happy Automation
Thanks,
@pratik.maskar
Thanks Peter I’ll try
Thank you for the inputs
How about this expression?
System.Text.RegularExpressions.Regex.Match(YourInputString,"[A-Za-z0-9]+(?=\W})").ToString
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.