Custom REGEXP Function to be used in a SQLITE SELECT Statement

前端 未结 2 477
离开以前
离开以前 2020-12-19 18:58

I have an SQLITE Database\'s File which in one of the table columns there is some simple Regular Expressions.

These Expressions are something like /foo(.

2条回答
  •  青春惊慌失措
    2020-12-19 19:14

    You can use SQLiteDatabase::createFunction documentation here or PDO::sqliteCreateFunction documentation here

    I did something like this:

    sqliteCreateFunction('regexp', '_sqliteRegexp', 2);
    ?>
    

    Use:

    SELECT route FROM routes WHERE pattern REGEXP 'your/url/string' LIMIT 1
    

提交回复
热议问题