Hi Team,
I want to get regex from dictionary ,please help me anyone for this
“str_name”:“(?<=hello:)([\S\s]*)”
io_config(“str_name”).ToString
Regards,
Raja G
Hi Team,
I want to get regex from dictionary ,please help me anyone for this
“str_name”:“(?<=hello:)([\S\s]*)”
io_config(“str_name”).ToString
Regards,
Raja G
Hi @Raja.G
Try like this
Pass your pattern in the asset or config file and give that pattern in your expression
System.Text.RegularExpressions.Regex.Match(StringVariable,io_config(“str_name”).ToString.trim)
Give it a try
Regards
Sudharsan
Seems like you’d be better off deserializing the JSON into an actual dictionary, and then look for the value there. JSON isn’t a dictionary, it’s just a string.
Hi @Raja.G
Share the sample input file
@Raja.G ,
Could you explain a bit more as to what you want to perform ?
As in your previous Topic, you did have the Json Converted to the Dictionary but a Regex expression was not introduced into the data.
We would need to know what exactly is your requirement.
Hi @supermanPunch ,
Actually i have string and regex both in txt json format ,i want to get and pass to matches and if condition
string to if
Regex to Matches
“str_name”:“(?<=Hello:\s) (\d{2}/d{2}/d{2})”,
Regards,
Raja G
@Raja.G ,
If the Json was already converted to Dictionary, then the expression you have used should get the value i.e the regex expression.
io_config("str_name").ToString
Maybe you want to loop all the values in the Json and use the Regex Expression present in each of them in Matches
Activity ? If so, Try to use For Each
Loop Activity and Pass the Dictionary as the Value to loop. Then we could access the Key and Value using .Key
and .Value
Properties.
I need to get date in regex from dictionary , “/” symbol have so only i couldnt able to get, please help me anyone for this.
Input json – “str_date”:“(\d{2}/\d{2}/\d{2})”
io_config(“str_date”).ToString
Expected output:
(\d{2}/\d{2}/\d{2})
Hello, have you tried using this function in UiPath? It is possible to perform regex functions natively
@Raja.G ,
In that case, an Escape character would be necessary. You would need to modify the Json in the below way :
"str_name":"(\\d{2}/\\d{2}/\\d{2})"
(Notice the \
at the beginning of \d
)
Output :
Let us know if you were able to make the necessary changes.
Hi @Raja.G
You can try with this expression
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=str_date”:\W)\S+(?=”)").Tostring
Regards
Gokul
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.