Using SIMILAR TO for a regex?

后端 未结 3 1904
一整个雨季
一整个雨季 2021-01-28 18:01

Why is the following instruction returning FALSE?

SELECT \'[1-3]{5}\' SIMILAR TO \'22222\' ;

I can\'t find what is wrong with that

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-28 18:40

    The operator is defined as:

    string SIMILAR TO pattern 
    

    so the first parameter is the string that you want to compare. The second parameter is the regex to compare against.

    You need:

    SELECT '22222' SIMILAR TO '[1-3]{5}';
    

提交回复
热议问题