S
S
sorry_i_noob2018-07-05 22:36:09
MySQL
sorry_i_noob, 2018-07-05 22:36:09

MySQL - in the database in the lines of the regular expression. How to search by comparing data with a regular expression in strings?

Hello. I have regular expressions in my database. Help write a request. Something like this one:

SELECT * FROM column WHERE url_regexp ПОДХОДИТ ДЛЯ СТРОКИ "/about"

A line should be found that has a url_regexp like this, for example: ^(\/about).*.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Immortal_pony, 2018-07-06
@Immortal_pony

SELECT * FROM `column` WHERE '/about' REGEXP url_regexp

D
Dimonchik, 2018-07-05
@dimonchik2013

1) in the line you leave only az : "about"
2) like %about%

A
Andrey, 2018-07-06
@VladimirAndreev

There are probably not millions of routes, select everything (filtering everything that is possible during the selection) and sort it out on the client.
or use regexp from mysql

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question