I have an input for a phone number in french format The input accepts two kinds of format, so i can input this:
- 0699999999
- +33699999999
no check is done for the length of the number.
The table in database, the field is of varchar 12, i can have shorter input though. The constraints: input contains only digits from 0 to 9, optional '+' sign accepted only if it starts the string, not after.
Currently i am in Angular with a directive, in that directive the heart is this expression :
var transformedInput = inputValue.replace(/[^0-9]/g, '');
i want the optional leading '+' sign, how can i achieve this? thanks.
+before applying the regex and add it later again