Let me explain what I am trying to do.
I'm trying to extract all phone numbers from a form of data, and it should result in an array of all phone numbers within the text.
So var I managed absolutely nothing, I've been trying to write a regex pattern for this for quite a while and can not seem to make anything work.
I'm reading off of a cheat sheet as I do not know so much about regex in total, except for finding simple things.
What I currently have uttered up is the following expression:
/\+*(?=[1-999])|(!?=0){7,9}[0-9]/
It doesn't even find anything, AT ALL.
I'm testing with the following string:
asd+27845513786 asd +98765433 asd
It should return the two phone numbers, but doesn't.
The rules I've laid out for it are:
1. Look for the international symbol, indicating it's an international dialing number with a valid extension(from +1 to +999).
2. If the plus symbol is present, make sure the next following character is a number.
3. If there is none, look at the length to validate it is between 7 and 10 digits long.
4. In the event that the number is divided (correctly via international standers) by either a hyphen(-) or space make sure the amount of digits in between them are either 3 or 4.
It sounds so simple, but my methodologies have not succeeded thus var.
If someone could give me advice on this matter it would greatly be appreciated.