I have a table in the db with one column containing a URL like http://example.com/users/*/profile
I am given a URL (like http://example.com/users/234/profile) and want to select all the rows in the db that match the url (in this case * is a wildcard).
I was thinking of using Regex to do this, by replacing the * with regex for any character. But am unsure as to what the SQL or LINQ code should be for the selection.
Do you guys have any ideas?
Unless I am missing something obvious, this should just require a simple LIKE query.
Regex is overkill and tricky in SQL queries.
Note: The % character is the equivalent of the * wildcard in SQL expressions.
If you want to use LINQ and are only working against SQL Server, you can use this syntax: