Get valid phone numbers using Regex

Hi
I have a requirement where I want to fetch only valid phone numbers from India…how can I do this using Regex?

@Nisha_K21

What all formats you get the numbers in…generally the validation would be [6-9]{1}\d{9} as minimum is 10 number and as of now number start with 9,8,7,6

cheers

@Nisha_K21
If you want to fetch the phone number including country code(+91) use this:
(?:(?:+91[\s-]?)|(?:0))?[6789]\d{9}

1 Like

@Nisha_K21,

What do you mean by only valid phone numbers from India. How would you validate the mobile numbers?

@Anil_G I need to fetch phone number including country code as well

I have a data which contains numbers exceeding 10 digit. I don’t want to fetch phone numbers that exceeds 10

@Nisha_K21

then try this

(\+91\s*|0)[6-9]{1}\d{9}\b - for country code definitely present
(\+91\s*|0)?[6-9]{1}\d{9}\b - for country code optional

cheers

1 Like

@Nisha_K21,

Still feels generic query. Try explaining with some dummy data.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.