malak_s
(Malak)
June 20, 2021, 8:56am
1
Hi,
I’m unable to extract each text between parentheses, below is example for all the possibilities that might happened:
String1 : “(AAA)-(P)+(QQ)”
result1 : AAA P QQ
__
String2 : “((M)-(XX))+(YY)”
result2 : M XX YY
__
String3 : “(AAA)”
result3 : AAA
Could any one help me to find one Regex that match all these examples.
Thank you
Srini84
(Srinivas Kadamati)
June 20, 2021, 9:36am
2
@malak_s
You can use Regex for this scenario
Check below for your reference
sampleString = YourString
use Assign sampleString = System.Text.RegularExpressions.Regex.Replace(sampleString,“[(]|[)]”,“”)
This will trim down the () brackets
use Assign sampleString = System.Text.RegularExpressions.Regex.Replace(sampleString,“[-]|[+)]”," ")
This will search for - and + and replace with space
Hope this may help you
Thanks
1 Like
malak_s
(Malak)
June 20, 2021, 9:43am
3
Srini84:
use
Thank you very much for your help, but what I need is to use regex.matches instead of replace, so for example1 after extracting I will loop through AAA,P, QQ .
Srini84
(Srinivas Kadamati)
June 20, 2021, 10:12am
4
@malak_s
You can loop by split
Assign a string variable and use sampleString.Split(" ")
The use For Each activity to loop
Hope this may help you
Thanks
malak_s
(Malak)
June 20, 2021, 10:31am
5
Thank you, I think I will do that
1 Like
system
(system)
Closed
June 23, 2021, 10:32am
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.