Check whether row items include alphabets, numbers or signs

Hi Everyone!

I am checking a Row Item called “Name In Bank” under for each activity.

I would like to check whether the names in each row contains alphabets, numbers or signs as below:


I have tried using Row.Item(“Name In Bank”).ToString.All(function (c) Char.IsLetterOrDigit(c)) and adding OR with Contains, but it does not work.

Are there anyways to set the IF condition at once, please? Or is it better for me to work it in Filter Datatable?


Can you try the following?

Check if it includes any character of them (at least 1 character)

System.Text.RegularExpressions.Regex.IsMatch(yourString,"[0-9A-Za-z ?'{}+,\-./]")

Check if it consists only the above characters

System.Text.RegularExpressions.Regex.IsMatch(yourString,"^[0-9A-Za-z ?'{}+,\-./]+$")


You want to remove this rows from your DT or you want DT containing only theese rows?

Hi @gabrielribas4

Maybe I can explain a little bit more.

I need to check whether the row items include the mentioned alphabets, numbers and signs first.

After that, I need to check whether the row items are started with the signs, space or blank characters.

I want to keep the rows that do not fulfil either one of the 2 requirement.

Do you have any idea? Thanks a lot.

Yeah! Lets do this! I just need some sleep, I’m already past the hour lol.

If no one comes up with the solution, I’ll bring it to you in the morning!

Sure, no hurry. Thanks Gabriel again!

Hi @Yoichi

Could I use it in Filter Datatable?

As I am now using: “Name In Bank” != System.Text.RegularExpressions.Regex.IsMatch(yourString,"[1]+$") to keep the row item with any characters not in the range.

But when I add ^ in a row item, other names without the sign ^ still show in the result Datatable.

  1. 0-9A-Za-z ?’{}+,-./ ↩︎


Unfortnately, FilterDataTable activity doesn’t support regex.

I think rows which you want to remove is “first character is 0-9A-Za-z and remains are consist only [0-9A-Za-z ?’{}+,-./]”, right? If It’s correct, the following might work.

dt = dt.AsEnumerable.Where(Function(r) (Not System.Text.RegularExpressions.Regex.IsMatch(r("yourColumn").ToString,"^[0-9A-Za-z][0-9A-Za-z ?'{}+,\-./]*$"))).CopyToDataTable


Hi @Yoichi

I think your formula works. Many thanks for your help.

But here comes to another question as I have three conditions now:

Condition 1: Row.Item("Bank Acct No").ToString.IsNumeric (But Following an assign function of Decimal. Parse before Condition 2 if it is true)

Condition 2: Row.Item("Bank Acct No").ToString.Length >6 And Row.Item("Bank Acct No").ToString.Length <16

Condition 3: Not System.Text.RegularExpressions.Regex.IsMatch(r("Name In Bank").ToString,"^[0-9A-Za-z'()][0-9A-Za-z ?'()+,\-./]*$"))

I want to keep the row items that cannot fulfil either one of the conditions. Could I write the range at once without merging datatables?


We can combine them with logical operator. The following probably works.

dt = dt.AsEnumerable.Where(Function(r) (Not Decimal.TryParse(r("Bank Acct No").ToString,New Decimal)) OrElse (r("Bank Acct No").ToString.Length <=6 OrElse r("Bank Acct No").ToString.Length >=16 )  OrElse  (Not System.Text.RegularExpressions.Regex.IsMatch(r("Name In Bank").ToString,"^[0-9A-Za-z][0-9A-Za-z ?'{}+,\-./]*$"))).CopyToDataTable


1 Like

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