Hello All,
I have requirement to fetch filenames from list of file (.txt files) where SSN or Phone number is coming. The SSN could be in specific format like 111-11-1111 or could be simply numbers like 111111111. If there is any Regex expression which can be used here or any other way of achieving it.
Thanks,
Can you share few screenshots how this SSN and Phone Number look like in your input?
Thanks
There is no specific pattern in my Organization. Its just simply any 9 letter number like 111111111 or 111-11-1111. For phone number either 0124-111111111 or 0124111111111. Its a universal pattern used everywhere.
Thanks. But just to add in the requirement. I am interested in checking if the number contain at least 5 integers. Eg. if it is 1111 or 111 or 1 then its a fail case or else if 11111 (anything greater than 5 integers) then its a pass case.
Hello @Ashish_Bansal
You can use matches activity and put the expression as below to fetch all the matching values
[\d-]{5,}. it will fetch only characters above 5
Maybe a two step check will work (just avoiding the exception that [\d-]{5,}
will match 1111- wrongly)
First step:
Second Step: Check the digits count
Combined:
Regex.Matches(strText, strPattern).Cast(Of Match).where(Function (m) Regex.Matches(m.Value, "\d").count > 5).toArray
@Ashish_Bansal You can use below exp to check there are 5 int or no
Varibel of type boolean Output = System.Text.RegularExpressions.Regex.IsMatch(Input, "\d{5}")
Input is the variable contains the SSN or Phone No
Exp returns true or false. If it true that means there are 5 int in the Input else not. Based on this you can perform the actions
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.