Posted By

davidrinnan on 02/23/10


regex search linebreak rowbreak

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


Search and replace within a field with regex in MySQL

 / Published in: MySQL

After a problem with row break in a text field I found this way of searching within a where clause in an SQL query. Can be used for selection or update / replace purposes of course.

  1. SELECT * FROM 'table' WHERE `name` REGEXP '\r'
  3. UPDATE 'table' SET 'field' = REPLACE(FIELD,"findvalue", "reaplcevalue") WHERE REGEXP 'regexp search expression'

Report this snippet  

You need to login to post a comment.