How to check the the string which is masked or not and ends with Numeric value

Hi all i need to check the string having the value masked value like “XXXXXX4567”

so the last four digits is Numeric values and the string is masked like i mentioned

kindly help me to get the proper regex expression to get it to check

HI @chandolusathi.kumar

Checkout this expression

System.Text.RegularExpressions.Regex.IsMatch(InputString,"[X]+\d{4}")

image

Regards
Sudharsan

You can use this directly in if condition @chandolusathi.kumar

Hi @chandolusathi.kumar ,

If the Masking Pattern is same as provided above, we could try with the below expression :

[X]+\d+

Expression to Check :

System.Text.RegualrExpressions.Regex.IsMatch(yourStrVar,"[X]+\d+")

The above will output true or false.

Hi @Sudharsan_Ka i need the condition satisfying that the string length is 10kindly help me

Try this @chandolusathi.kumar

System.Text.RegularExpressions.Regex.Match(InputString,"[X]+\d{4}").Tostring.Length=10

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