How to get E212 and E214 value from regex

Hi Team,

My Input:

E. 212 Number series Mobile Country Code (MCC) Mobile Network Code (MNC)
Page 10 of 35
RAEX IR.21 document (schema vers. 16.0)
338 050
E. 214 Mobile Global Title (MGT) Country Code of MGT (CC) Network Code of MGT (NC)
1 87638

I have tried with regex for E214 and E212 but E214 working fine not E212

FOR E214: (?<=E.\s+214\s+Mobile.\n). (It’s fetched correct value : 1 87638)
For E212: (?<=E.\s+212\s+Number.\n). (Not working ) (please anyone provide possible scanario regex :pray: )

any one help please

Thanks
Shaik Muktharvalli

cannot confirm

Have a look here

and refering to groups:
grafik

[CheatSheet] - System.Text.RegularExpressions | RegEx - News / Tutorials - UiPath Community Forum

1 Like

can you share regex please

thanks
shaik

(?<=(E.\s+21\d)[\s\S]+?)(^\d[\d ]+)
1 Like

getting null value @ppr

please help

thank
shaik

@ppr

please check

System.Text.RegularExpressions.Regex.Match( TADIG_Data,β€œ(?<=(E.\s+212\d)[\s\S]+?)(^\d[\d ]+)”).Value.Trim().Replace(" β€œ,”")

hi @shaik.muktharvalli1

tr this regex
(?<=E. 212.\n.\n.\n)(\d{3}\s\d{3})

having only two numbers are present but digit change randomly

thanks
shaik

System.Text.RegularExpressions.Regex.Match(input,β€œ(?<=E. 212.\n.\n.\n)(\d+\s\d+)”).Value

try this if you able to extract 212 numbers

if digits changes use this one let me know if its working

1 Like

getting error

What is variable type of e21?

String type variable

check your input you have passed correctly

1 Like

The image shows a code snippet using regular expressions to extract specific numerical patterns from a text string related to Mobile Country Codes (MCC) and Mobile Global Titles (MGT), and converting the matches into an array of formatted strings. (Captioned by AI)
we finetuned the pattern on

"(?<=(E\.\s+21\d)[\s\S]+?)(^\d[\d ]+)"

\. escaping the dot and and not defining the any item char

1 Like

Can you send sample workflow please @ppr

it is just using assign activities, so you can model it faster by yourself.

ensure:
RegexImport

@ppr mymatches variable type please

have a look at the share regex cheatsheet

mymatches is outcome from

so from the docu we can derive:
MatchCollection

This pattern should be able to extract both E. 212 and E. 214 numbers, ensuring that the numbers exist on a new line, which helps to ignore other unrelated numbers:
(?<=E. 21(\s|\S)+)(?<=\n)(\d+\s?\d+)

To refine it further, you can use the following patterns for each case:

  • For E. 212: (?<=E\. 212(\s|\S)+)(?<=\n)(\d+\s?\d+)
  • For E. 214: (?<=E\. 214(\s|\S)+)(?<=\n)(\d+\s?\d+)

These patterns ensure that only the numbers immediately following E. 212 or E. 214 on a new line are captured.

Thanks @mohamed.shaker regex working fine

1 Like