Welcome to the community
Can you please provide more samples and which are the constant parts in this string
Cheers
Here is the one more sample with the same part of the string
and I want to mention that the line will always start with the BGM tag
Hi,
How about the following?
System.Text.RegularExpressions.Regex.Match(strData,"(?<=BGM\+[^+]+\+)[^+]+").Value
Regards,
Welcome to the forums
You can try as below
Later you can place a replace for +
Hope this may help you
Thanks,
Srini
@Srini84
The regex is showing many matches, instead of those all i need to fetch only the BGM tag part and attaching the screenshot regarding the multiple matches
The text for the required regex pattern is:
UNB+UNOA:3+QAMORRISONSHUB:ZZ+QAMORRISONSTP1:ZZ+220701:0742+1421++ORDERS’
UNH+142100001+ORDERS:D:96A:UN’
BGM+220:::qwertyuiopqwertyuiopqwertyuiopqwert+morisonsmaxchars+4’
DTM+4:20232046:102’
DTM+137:20220701:102’
DTM+64:30081332267090:204’
DTM+63:30082009153000:204’
DTM+200:20220701:102’
FTX+AAB+++30th Day of 2nd Month, Discount 0%’
FTX+COI+++xkjmku1234567890mnjkwetui345678rddfxkjmku1234567890mnjkwetui345678rddf:xkjmku1234567890mnjkwetui345678rddfxkjmku1234567890mnjkwetui345678rddf:xkjmku1234567890mnjkwetui345678rddfxkjmku1234567890mnjkwetui345678rddf:xkjmku1234567890mnjkwetui345678rddfxkjmku1234567890mnjkwetui345678rddf:xkjmku1234567890mnjkwetui345678rddfxkjmku1234567890mnjkwetui345678rddf’
FTX+COI+++xkjmku1234567890mnjkwetui345678rddfxkjmku1234567890mnjkwetui345678rddf:xkjmku1234567890mnjkwetui345678rddfxkjmku1234567890mnjkwetui345678rddf:xkjmku1234567890mnjkwetui345678rddfxkjmku1234567890mnjkwetui345678rddf:xkjmku1234567890mnjkwetui345678rddfxkjmku1234567890mnjkwetui345678rddf:xkjmku1234567890mnjkwetui345678rddfxkjmku1234567890mnjkwetui345678rddf’
FTX+SIN+++qwertyuiopqwertyuiopqwertyuiopqwertqwertyuiopqwertyuiopqwertyuiopqwert:FTXSIN2 FTXSIN2 FTXSIN2 FTXSIN2 FTXSIN2 FTXSIN2 FTXSIN2 FTXSIN2 FTXSI2:FTXSIN3 FTXSIN3 FTXSIN3 FTXSIN3 FTXSIN3 FTXSIN3 FTXSIN3 FTXSIN3 FTXSI3:FTXSIN4 FTXSIN4 FTXSIN4 FTXSIN4 FTXSIN4 FTXSIN4 FTXSIN4 FTXSIN4 FTXSI4:FTXSIN5 FTXSIN5 FTXSIN5 FTXSIN5 FTXSIN5 FTXSIN5 FTXSIN5 FTXSIN5 FTXSI5’
Please try this
System.Text.RegularExpressions.Regex.Match(str,"(?<=BGM.*\+).*(?=\+ *\d+)").Value.Split({"+"},StringSplitOptions.RemoveEmotyEntries)(System.Text.RegularExpressions.Regex.Match(str,"(?<=BGM.*\+).*(?=\+ *\d+)").Value.Split({"+"},StringSplitOptions.RemoveEmotyEntries).Count-1)
I am first extracting the required text in line BGM and then using split on plus to get the last value which is the required one
Hope this helps
cheers
@Yoichi
I was able to get the required value with .NET(C#)
Thankyou
can you help me with this PCRE2 (PHP>=7.3) at flavor?
Hi,
PCRE means “Perl Compatible Regular Expressions” for PHP.
In general, it’s unnecessary if we use UiPath.
Regards,