Given a port string, Let me return the rows from the (MySQL) database which contain a wildcard expression that will match the string. For instance, if I've got a table that contains these wildcard expressions:

foo.*
foo.bar.*
erg.foo.*

and my input string is "foo.bar.baz", i quickly should obtain the rows "foo.*" and "foo.bar.*".

Any applying for grants how this is often implemented? I am wishing it may be accomplished having a query, however i may need to choose all relevant rows and perform the matching within the application.

SELECT  *
FROM    mytable
WHERE   'foo.bar.baz' RLIKE match

You aren't restricted to the wildcards and may use any regular expression MySQL supports.

However, should you simply want to process asterisk wildcards, you can utilize this syntax:

SELECT  *
FROM    mytable
WHERE   'foo.bar.baz' LIKE REPLACE(REPLACE(REPLACE(REPLACE('\\', '\\\\'), '.', '\\.'), '%', '\\%'), '*', '%') ESCAPE '\\'