in reply to Re: Map file-glob-style patterns to SQL "LIKE" expressions, with escaping
in thread Map file-glob-style patterns to SQL "LIKE" expressions, with escaping

If the original file-glob string is something like:
what\?_not\*.%
a file-glob sees a backslash escape before the "?" and "*" (to match a literal question mark and asterisk), and treats "_" and "%" as normal (literal) characters.

For conversion to an sql "like" pattern, the "\" must be removed from in front of "?" and "*" (because these characters don't need to be escaped now) and must be added in front of each "_" and "%" (to keep them literal, as they were in the file-glob).

  • Comment on Re^2: Map file-glob-style patterns to SQL "LIKE" expressions, with escaping
  • Download Code

Replies are listed 'Best First'.
Re^3: Map file-glob-style patterns to SQL "LIKE" expressions, with escaping
by merlyn (Sage) on Apr 01, 2005 at 03:28 UTC