반응형
Notice
Recent Posts
Recent Comments
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Archives
Today
Total
관리 메뉴

차근차근

MYSQL (REGEXP) 정규식 사용 검색 본문

개발

MYSQL (REGEXP) 정규식 사용 검색

철산92 2017. 12. 5. 14:49
반응형


  INSERT INTO cities VALUES ('London');
  INSERT INTO cities VALUES ('Paris');
  INSERT INTO cities VALUES ('Rome');


SELECT name FROM cities WHERE name RLIKE 'A|B|R';
  -- or
  SELECT name FROM cities WHERE name REGEXP 'A|B|R';
  -- or using LIKE
  SELECT name FROM cities WHERE name LIKE '%A%' OR name LIKE '%B%' OR name LIKE '%R%'


name
Paris
Rome


  SELECT name FROM cities WHERE name RLIKE '^A|^B|^R';
  -- or
  SELECT name FROM cities WHERE name REGEXP '^A|^B|^R';
  -- or using LIKE
  SELECT name FROM cities WHERE name LIKE 'A%' OR name LIKE 'B%' OR name LIKE 'R%'

name
Rome


반응형
Comments