Regex -patten matching

Hi all ,
Im reading an excel and for each row i need to use regex and get only alphabets, special characters and digits for each row accordingly. But for special characters and digits and im getting an empty value while displaying the result.
The properties here in replace matching activity im little confused.

Main.xaml (15.5 KB)
Can you pls check and help where i went wrong

Hi @parvathi_ayanala

Can you please share excel with dummy data so that we can help you with solution. Please specify your requirement.

Regards,

regexchallenge.xlsx (9.1 KB)

Hi @parvathi_ayanala

An error has been identified digits block

alpphabets = "[^a-zA-Z]"
digits = "[^0-9]"
specialChars = "[a-zA-Z0-9]"

Hi @parvathi_ayanala

In Replace Matching Patterns activity you have given the

Text to Replace as CurrentRow(1).ToString for index=1
Text to Replace as CurrentRow(2).ToString for index=3

You need to pass CurrentRow(0).ToString in all three matching patterns.

Regex Expressions are:

alphabet="[^a-zA-Z]" 
specialchar= "[a-zA-Z0-9]+"
Digit= "[a-z]+"

Refer the below Image for Better understanding
Sequence7.xaml (15.8 KB)



Hope it helps!!

Thanks @Parvathy will try and update

1 Like

@Parvathy can you share the xaml. I only want to the in the regex pattern activity the properties “replace text” what should be used. I
replace text: “”
Text to replace: “Current row”

I have shred it above @parvathi_ayanala
Sequence7.xaml (15.8 KB)

Regards,

1 Like

@parvathi_ayanala

Simply use assign activity:
For each row in datatable:

alphabets = System.Text.RegularExpressions.Regex.Replace(rowValue, "[^a-zA-Z]", "")
digits = System.Text.RegularExpressions.Regex.Replace(rowValue, "[^0-9]", "")
specialChars = System.Text.RegularExpressions.Regex.Replace(rowValue, "[a-zA-Z0-9]", "")

Hope it helps.

1 Like

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