Current location: Hot Scripts Forums » Other Discussions » Database » Help with mySQL REGEX


Help with mySQL REGEX

Reply
  #1 (permalink)  
Old 02-05-11, 11:15 PM
jdadwilson jdadwilson is offline
New Member
 
Join Date: Feb 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Help with mySQL REGEX

In a mySQL db I have a table in which one field contains last names. About 99% of the 50,000+ records contain only a single name. But a few 'need' to contain two or more names. I have implemented this by using a pipe to separate the names which I then can explode into an array of names.

Problem: I need to search on the name field to select all records containing a search name (e.g., 'Smith' in 'Jones|Smith|Thompson'). A search on 'Smith' should only return 'Smith' and not 'Smithson'. Smith should be found regardless of the position within the "array".

My skill set is towards the advanced side for PHP and mySQL but below novice with REGEX. Any assistance would be greatly appreciated.

jdadwilson
Reply With Quote
  #2 (permalink)  
Old 02-07-11, 03:49 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
You should take a look at the following page: MySQL :: MySQL 5.5 Reference Manual :: 11.5.2 Regular Expressions, scroll down till you find the description of [[:<:]], [[:>:]].
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
Reply

Bookmarks

Tags
mysql, php, regex


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Useful MySQL Resources ptesone Database 30 02-23-11 08:28 AM
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 02:22 AM
MySql Labyrinth moron Database 4 02-22-08 02:46 AM
UPDATE: MySQL Auto Backup & Export v1.1 Beyonder General Advertisements 2 03-21-05 02:05 PM


All times are GMT -5. The time now is 05:15 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.