extract a pattern number from url mysql or python

后端 未结 2 1370
清酒与你
清酒与你 2021-01-26 00:20

I have a bunch url that has a string either has

hotel+4 digit number: hotel1234 
or slash+4digit.html: /1234.html

Is there a regex to extract

2条回答
  •  醉梦人生
    2021-01-26 00:39

    You can try the REGEXP

    SELECT * FROM Table WHERE ColumnName REGEXP '^[0-9]{4}$'
    

    or

    SELECT * FROM Table WHERE ColumnName REGEXP '^[[:digit:]]{4}$';
    

提交回复
热议问题