Phone mask for Philipines?

Hi guys!
Did anyone build an input mask for Philipine’s phone numbers already?

Their mobile numbers have the exact same format as the US phone numbers, but their landlines have different spacing, although the same number of characters.
I use “Mask Input” plugin from Renato Asse to Brazil phone numbers and it handles that great changing between the landlines and mobile lines depending on the number of characters but I’m having issues doing that for the Philipines.

For now, only thing I could do is to have a checkbox for ph-land lines. That way, Renato’s plugin works great.

Use this in your regex:
/\(([0-9]{2}|0{1}((x|[0-9]){2}[0-9]{2}))\)\s*[0-9]{3,4}[- ]*[0-9]{4}/

1 Like

wow, that was fast. I really appreciate that, mate.
Unfortunately, I need to show that mask format in the input for these users, but we don’t save that spaces, dashes and parentheses in the database :frowning:

like that?

Yep. Again, you’re awesome for all the input you’ve added to the community, mate.

But regardings the masks, yes. I have them working great for US numbers, BR numbers, but it needs a condition to understand that the user input is a land or mobile PH number. Problem with it is that PH land and mobile numbers have the same amount of characters; So I’m thinking on closing this with showing a checkbox for land phones whenever the city is a PH city, then using the mask I already have working for it.

Btw, I’m looking at your profile here. I don’t think we can afford to hire you just yet, but I’m buying you a coffee for sure. Couldn’t find a link for it, so I’ll buy your plugins when I get on lunch break here

yeah the best option is a dropdown for the user to select their country imo.

Haven’t seen a script that can automatically detect the region for phone numbers cause I think it may be too hard with all the similarities, but I could be wrong.