cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Regex for testing if a minimum number of digits appear in the text

leelandclay
Graph Buddy

First...back story.
I have a dating app that lets people create profiles and have a description. However, I've started getting bombarded with people who are creating fake accounts with the intent of scamming people. The most common way seems to be by adding phone numbers to their description. Due to the way that they write the description, I want to have a query that returns any description has 10 or more numbers within it.

I've been trying to get a regex together that works, but I have not done any Java Regex work previously...and C# regex commands don't work :). I've been looking through examples, but everything is very basic or too complex for me to figure out how to get it to do what I want :/.

I've gone through a lot of examples and they don't seem to return everything. The only regex that actually returned anything is:

.[0-9].*{7,}

However, it completely ignores the minimum of 7 instance part and the only results are entries that have a number doesn't have anything immediately before or after it. Which means that the only way it matches is if the property starts with a number.

I've tried a lot of different variations, but I'm starting to feel like a monkey banging at a typewriter expecting to write a proof to relativity. Help?????

2 REPLIES 2

llpree
Graph Buddy

I know the pain 🙂
My right-hand helper on all things regex is: https://regex101.com/

Yes, that's mine too. However it doesn't support the Java Pattern Matcher. So the important parts like any non digit (\D) doesn't work properly.