Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Find user from mongo DB using phone number #2350

Unanswered
codydev-git asked this question in Q&A
Discussion options

How are you?
I hope you are doing great.
I need a function to find a user from the database using a phone number.
But in the database, the user's phone number has many formats
+1 (1234) 123-1234
1234567890
(1234) 124 1234
+1234567890
+1 234 567 9012
really many formats...
.....
In this case, How can I find a user with this format "1234567890" phone number?
Thank you

You must be logged in to vote

Replies: 4 comments

Comment options

in this situation, regex is your friend.

You must be logged in to vote
0 replies
Comment options

Could you please make a sample?

You must be logged in to vote
0 replies
Comment options

If your format is like "1324654897" that. You can simply use this regex : .*\S\d

You must be logged in to vote
0 replies
Comment options

In the database, a user's phone number is "+1 (324) 654-7890"
How can i find the user with "13245647890"?

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
Converted from issue

This discussion was converted from issue #2347 on February 15, 2022 07:31.

AltStyle によって変換されたページ (->オリジナル) /