How to find only alphabets and combination of alphabets and numbers using regex in uipath?

for example my string is
"WINDOW HOST WITH MS 00440452 1 2900.00 0.00 2900.00 18.00 0.00 0.00 522.00 3422.00 SQL123 DB "
here i want only alphabets and combinations of alphabets and numeric.
Anyone pls help

Can you share the expected output? @ASWATHY_K

Hi @ASWATHY_K

Here you can try with Regex.Replace method

System.Text.RegularExpressions.Regex.Replace(YourString,"\d","").ToString

It will get only the alphabets in the input string

Regards
Gokul

WINDOW HOST WITH MS SQL123 DB
This is the expected output

Hi,

Hope the following helps you.

\b([A-Za-z]+|[A-Za-z\d]*(\d[A-Za-z]|[A-Za-z]\d)[A-Za-z\d]*)\b

Regards,

@ASWATHY_K

Try with this below pattern it will work your scenario

Thanks
Varun

Only get the first value Window

Only get the first value “Window”

alphabets get correctly then how to find the combination of alphabets and numeric like
“SQL123”
Pls help me

Hi,

Do you need to get single string as result? If so, the following will work.

String.Join(" ",System.Text.RegularExpressions.Regex.Matches(yourString,"\b([A-Za-z]+|[A-Za-z\d]*(\d[A-Za-z]|[A-Za-z]\d)[A-Za-z\d]*)\b").Cast(Of System.Text.RegularExpressions.Match).Select(Function(m) m.Value))

Sequence3.xaml (4.9 KB)

Regards,

HI @ASWATHY_K

Try this expression


System.Text.RegularExpressions.Regex.Match(YourString,"\D+(?=\s\d)").ToString+" "+System.Text.RegularExpressions.Regex.Match(YourString,"[A-Z]+\d.+$").ToString

Regards
Sudharsan

Thanks .
This is exactly what i want ,Thank you

1 Like

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