I have a table like this:
// routes
+----+-----------------------------+
| id | route |
+----+-----------------------------+
| 1 | /tracking_code/expire/{id} |
| 2 | /tracking_code/list |
+----+-----------------------------+
{}
means a dynamic value. And I need to match the first row for this entry value: /tracking_code/expire/2
. I guess I need to use regexp. Any idea how can I do that?
My current workaround is using LIKE
clause like this:
SELECT * FROM routes WHERE route LIKE :entry%
Also I should remove that number of the end of entry like /tracking_code/expire/
.
Sadly my approach won't work for complicated routes like this: /tracking_code/expire/{id}/temp
. Anyway, how should I use regexp for this?