Identify number "type" by length, grouping, etc - abstraction

Let's assume there's a text box somewhere on the page. Users can enter any number of any length, with spaces, hyphens, parentheses, etc. to define groupings. The system returns a list of what kinds of numbers that specific format could match. That is, an input of "111-11-1111" would return, among anything else applicable, "Social Security Number"; an input of "(111) 111-1111" would return "Canadian/American phone number"; an input of "1111 1111 1111 1111" would return "Credit card".
The implementation of this would be trivial, but is there a giant list out there of different number formats?

I think you need to write regular expressions for each type of number and if that regular expression matches than return the type name. You can find lots of regular expressions for SSN, phone number and credit card number on internet.
Check this thread for phone number regular expression.
Phone Number Regular Expression

Related

Shall I use Special Characters in Firebase Param Value "event_params.value.string_value" & query in Bigquery?

In Firebase it is clearly mentioned that "Param values can be up to 100 characters long. The "firebase_", "google_" and "ga_" prefixes are reserved and should not be used."
Source: https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Param
But in Google, they did not mention the usage of special characters.
Shall I use special characters like forward slash & Unicode in Firebase Param Value "event_params.value.string_value"?
Will the special characters in Firebase Param Value "event_params.value.string_value" be accepted in Bigquery Table field event_params.value.string_value ?
The documentation you referenced clearly specify requirements for parameter's name and value - so obviously you must comply
Params supply information that contextualize Events. You can associate up to 25 unique Params with each Event type. Some Params are suggested below for certain common Events, but you are not limited to these. You may supply extra Params for suggested Events or custom Params for Custom events. Param names can be up to 40 characters long, may only contain alphanumeric characters and underscores (""), and must start with an alphabetic character. Param values can be up to 100 characters long. The "firebase", "google_" and "ga_" prefixes are reserved and should not be used.
Meantime, those limitations have nothing to do with BigQuery
So, if you are dealing with non-firebase data - feel free to use all those chars
P.S. the best recommendation I can give for such cases - try by your own and you will see. It is so easy and fast to get this type of questions answered!

ASP.NET RegularExpressionValidator False Trigger

I'm validating a password that must be letters and digits with at least one digit and one upper case letter. I am using the following RegEx expression to do so:
(?=(^[a-zA-Z0-9]{6,16})$)(?=.*\d)(?=.*[A-Z])
Using this pattern, the password "Valid101" should be valid and it worked as expected at both A Better .NET Regular Expression Tester and REGEX TESTER. But, when I use it in my ASP.NET user control's RegularExpressionValidator it wrongly decides that password "Valid101" is not valid.
I'm hoping someone could suggest what might be wrong.
The pattern you have only consists of zero-width assertions, of lookaheads. They do not consume the text they match, so the match value after the regex matches is an empty string. The RegularExpressionValidator requires a full string match (i.e. the string matched should be the whole input string).
So, instead of (?=(^[a-zA-Z0-9]{6,16})$)(?=.*\d)(?=.*[A-Z]) use
^(?=.*\d)(?=.*[A-Z])[a-zA-Z0-9]{6,16}$
It will assure there is a digit and an uppercase ASCII letter in the string, and then will match (consume) 6 to 16 ASCII letters and digits.

ASP.Net Validation Expressions for Phone Numbers

I need a Validation Expression to validate an Egyptian mobile number as an input in my form.
Egyptian Mobile Number:
must Contain 11 Digits
must Begin with '01'
the third digit must be either '2' or '1' or '0'
Do you need to support starting '+' characters, spaces or '-' signs inside your phone number? If you don't and you need to support just exact what you said then you can use this pattern:
"^01[0-2][0-9]{8}$"

Regex valid numbers with thousand separator

I'm doing a validation in asp.net textbox, and the textbox only allows user to input number
i.e.
valid numbers:
1234
12.345
12,345,678.231
12,345,678
invalid numbers:
-1234
12.23.45.67
12,
12,34,56
12,345,6
I'm trying to use a regex to validate the user's input on client side with the below regex:
^(?=.+)(?:[1-9]\d*|0)?(?:\.\d+)?$
The problem is:
the above regex only consider below as valid:
1234
12.345
How to modify the above regex to check if the thousand separator being entered into the correct place or not?
this seems to work ^\d+(,\d{3})*(\.\d+)?$
Demo

asp.net regular expression validator for email or numeric

Is it possible use a regular expression validator for a textbox which accepts either user email or phone number (11 digits number which begins with 09) ?
so one regex is needed which accepts one of two cases, email or number.
For Email : "\w+([-+.']\w+)#\w+([-.]\w+).\w+([-.]\w+)*"
[0][9][0-9]

Resources