* Markus Krötzsch <[EMAIL PROTECTED]> [2007-12-30 22:10]: > OK, my conclusion now was to support the following syntax: > > [[property% *subs?r*]] > > where ? and * represent _ and % in SQL.
I think this is fine generally, but now you cannot query for a literal * or ? anymore, AFAIK. Not a huge deal, but before, "a_b" searched for "a, followed by any char, followed by b", while "a\_b" searched for "exactly a_b". Properly escaping everything gets messy rather quickly, as \ can also be escaped to query for a literal \, so you need translations like: ? => _ \? => ? \\? => \\_ \\\? => \\? The following regular expressions work fine for me, but unfortunately they are quite ugly: $value = str_replace(array('%', '_'), array('\%', '\_'), $value); // escape % and _ $value = preg_replace('/(?<!\\\\)((?:\\\\\\\\)*)\*/', '$1%', $value); // if there's an even number of \, change * to % $value = preg_replace('/(?<!\\\\)((?:\\\\\\\\)*)\?/', '$1_', $value); // ditto for ? and _ $value = preg_replace('/(?<!\\\\)((?:\\\\\\\\)*)\\\\\*/', '$1*', $value); // if there's an odd number, * was escaped and should stay as is; but the last \ is removed $value = preg_replace('/(?<!\\\\)((?:\\\\\\\\)*)\\\\\?/', '$1?', $value); // ditto for ? I think these should be added to SMW, so all characters can be queried. Regards, Thomas
signature.asc
Description: Digital signature
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel