O
O
Optimus2015-09-09 19:07:44
MySQL
Optimus, 2015-09-09 19:07:44

Is it possible to do a regular expression in a SQL query?

The field in the database has a value, for example 555787868111
Is it possible to make a SELECT of type 555*111 i.e. all values ​​in the database starting at 555 and ending at 111, regardless of what and how much is in the middle. If so, how to write such a request?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2015-09-09
Pyan @marrk2

regular expressions are not needed for this, just LIKE
https://dev.mysql.com/doc/refman/5.5/en/string-com...

I
Igor, 2015-09-10
@fredyk

There is also REGEXP, if you need regular expressions =)
SELECT name FROM table WHERE name REGEXP "^555.*111$"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question