Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regular Expression or Database for Check if String is Person's Name?

Tags:

regex

I have an application that reads XML information about a vehicle title and parses it into my application. In my database, I always store my names according to whether it is an individual's name or a company's name(because that can occur in my system). The trouble is that the XML source has name data, but it does not specify if it is an individual or a company. I need to know so I can store it appropriately in my database. Is there a database of names or a regular expression or a library that could check the string to see if it matches an individual's name? Thanks!

like image 452
Austin Avatar asked Sep 19 '25 00:09

Austin


1 Answers

At a large telco that I used to work for we had this problem. We tested the following regular expression on 2 Million plus names

([A-Z][a-z][a-z]*)  *([A-Z][a-z]*)\.?  *([A-Z][a-z][a-z][a-z]*)

We got a 99.8% accuracy with this. The data was fairly clean. This was for a regular expression engine in C - so the syntax may be a little off from perl. I don't know if you will need the parenthesis.

like image 105
Philip Schlump Avatar answered Sep 23 '25 11:09

Philip Schlump



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!