Can you help me on this

Hi

Need Regex expression to extract 6 digit number only

Sample input
18846524662
154649
15975326845
554488

Output
154649
554488

Hi @Robin_0101

Welcome to UiPath community

Try with this expression Assign activity

System.Text.RegularExpressions.Regex.Match(YourString,"\b\d{6}\b").Tostring

image

Regards
Gokul

1 Like

@Robin_0101

welcome to the community

please try this \b\d{6}\b

Hope this helps

cheers

1 Like

Hi,

FYI, another approach :

(?m)^\d{6}$

String.Join(vbcrlf,System.Text.RegularExpressions.Regex.Matches(yourString,"(?m)^\d{6}$").Cast(Of System.Text.RegularExpressions.Match).Select(Function(m) m.Value))

Regards,

1 Like

You can use below expression:

output= System.Text.RegularExpressions.Regex.Matches(str_input,“\b\d{6}\b”)

image

Hi @Robin_0101

Use this syntax:

strinput= "18846524662
           154649
           15975326845
           554488"
output= System.Text.RegularExpressions.Regex.Matches(strinput,"\b(?<=\n\s*)\d{6}\b")

DataType of output is IEnumerable(System.Text.RegularExpressions.Match)
=> Run a For Each for the variable output and you can print the output in Message Box, Log Message.

Hope it helps!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.