Checking the correctnes of a string

Hello, I want to Check if the selected string is build as follows.
a) B must be first character of a sting!
b) char B must be followed with exactly 7 numbers, and nothing more.

Thx for help.

System.Text.RegularExpressions.Regex.IsMatch(“B1234567”, “\bB\d{7}\b”)

Hi @tomaz

How about this expression?

System.Text.RegularExpressions.Regex.IsMatch(Inputstring,"B\d{7}")

Output will be Boolean format

Regards
Gokul

Just have a look on the different tests:
grafik

1 Like

@tomaz

keep in mind:
grafik
eight following digits will result to true
grafik
Starting with A will result to true

vs.

Thank you.

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