I'm working with an input for a phone number in French format which can accept two different formats:
- 0699999999
- +33699999999
There is currently no check for the length of the number.
In the database table, the field is varchar 12, but shorter inputs are allowed. The constraints are as follows: the input must contain only digits from 0 to 9, and an optional '+' sign is accepted if it appears at the beginning of the string, not afterwards.
Currently, I am using Angular with a directive that includes this expression:
var transformedInput = inputValue.replace(/[^0-9]/g, '');
I would like to include the optional leading '+' sign, how can I achieve this? Thank you.