tags:

views:

67

answers:

3

I am storing values in database like this

www/content/lessons/40/Digital Library/document1.doc

I need to extract the file document.doc.

How to retrieve this value from mysql using regular expression.

+4  A: 

you not need to use regexp (low performence) use substring_index instead

SELECT SUBSTRING_INDEX('bbb/bbbbbb/bbbbbbbbb/bbbb', '/', -1);

link :

http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_substring-index

Haim Evgi
A: 

MySQL Regular Expressions

Sri Kumar
A: 
SELECT * FROM documents WHERE name REGEXP "<your regexp here>"

More info: Mysql Regexp Manual

Darmen