3

i have rows of text like this in database:

row1 -> text text!? sometext..!
row2 -> text!! sometext !whatever
row3 -> sometext !
row4 -> !this is sometext sometext

just like preg_match, what is query to call rows that contains !(word) and !!

the result i want is like:

text!! sometext !whatever
!this is sometext sometext

anyone can help?

thank you very much!

2
  • 1
    your second result does not contain !! .. so should your row contain !sometext AND !! or only one of it? Commented Jan 20, 2012 at 15:15
  • hello, it could means !hello or !whatever, any text after ! (with no spacing) Commented Jan 20, 2012 at 15:24

1 Answer 1

7
SELECT yourfield
FROM yourtable
WHERE yourfield REGEXP '(!!|!sometext)'

relevant docs here: http://dev.mysql.com/doc/refman/5.1/en/regexp.html

Sign up to request clarification or add additional context in comments.

1 Comment

hello Marc, thank you for your answer.. but "sometext" is not just "sometext", it could means !hello or !whatever, any text after ! (with no spacing) ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.