• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 306
  • Last Modified:

PHP RegEx Help

I am in need of some help in putting together an algorithm to determine if a user's information matches or closely matches one found in the database.  The list that is read into a local mysql database comes from the US Government's Denied Person's List found at http://www.bis.doc.gov/dpl/thedeniallist.asp
Unfortunately they do not separate first name, last name, etc...so what I am looking for is a way of checking a user entering their own first name, middle name, and last name into separate form fields against this list.  Any help would be greatly appreciated!
0
PhillipsPlastics
Asked:
PhillipsPlastics
  • 5
  • 3
  • 2
1 Solution
 
saimazzCommented:
i think regexp is not an option here. i suggest you to put that info of government to the some database, then you can index fields and take a deep search or take search with like (for example first search name then search surname and compare how much close search was to denied persons). In that way your all proccess should work faster, because it will be less calculates and it will very accurate.
0
 
PhillipsPlasticsAuthor Commented:
Speed is less of a concern than accuracy, the reason for thinking of using PHP over pure SQL is because I am more familiar with PHP and haven't a clue of where to start using pure SQL.  I am collecting all the information as separate entities however the government info comes in on one field and last name and first names are sometimes separated by commas and sometimes separated by spaces.
0
 
Kyle HamiltonData ScientistCommented:
You could concat your own fields into one string and then check against the database. You'll need something to account for the possible commas and the absence/presence of middle names and such.

Just a thought...
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
PhillipsPlasticsAuthor Commented:
I thought of doing that but it seemed less accurate than doing something akin to the substr function and breaking them apart from the database, that way there is only one thing to check versus every permutation inside the db.
0
 
Kyle HamiltonData ScientistCommented:
I'm not an expert on this, but this might help - example2 on this page:

split string with php

I'm gonna butt out of this one before I give you some bad advice. Good luck.
0
 
PhillipsPlasticsAuthor Commented:
Well I appreciate any direction at this point not really sure what the best approach is going to be to give me the most accurate results, the issue shouldn't arise possibly ever but I certainly don't want to miss a hit or have a large number of false positives.
0
 
saimazzCommented:
split string is the explode alternative, there is not a solution to search results. i lookt more at your problem i think that the best way is to use database and then analize with queries. it will be very accurate.
0
 
PhillipsPlasticsAuthor Commented:
Any suggestions on how to approach doing that?  I have entries in the db such as:
AL NASSER, ABDULAH
AL NASSER, ABDULLAH
AL-MASHAN, MOHAMMAD
AL-MASHAN, MOHAMMAD
ALEX GOH
ALI ESLAMIAN
ALI ESLAMIAN
0
 
saimazzCommented:
so here you can searh by given name. dont forget to add unique id in your table for each row (for compare reaseon). so query could look like this:

select id from rejected_list where name like '%given name%' and name like '%given surname%'

something like this
0
 
PhillipsPlasticsAuthor Commented:
Oh yea that is easy enough didn't think about the wildcard on either end!  Thanks!
0

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now