Simetrical wrote:
On Thu, May 8, 2008 at 12:12 PM, DanTMan
<dan_the_man(a)telus.net> wrote:
"/^\s*(\S+|`[^`]+`)(\.\S+|\.`[^`]+`)?\s*$/i"
All we need to test for is non-whitespace. Anything which is completely
unbroken by whitespace can't be a query at all. "SELECT*FROMfoo" ;)
But "database . table" is valid, since you make the point about whitespace.
So
/^\s*(\S+|`[^`]+`)(\s*\.\s*(\S+|`[^`]+`))?\s*$/
should work.
Heh... ok, then I'll trim it. Won't break anything because if you pass
in `'s they'll armor against the stripping.
And I handily
moved the condition to the second group to optimize the regex.
The \S+ alone will completely match 'foo.bar' without any backtracking
or anything from the processor.
I don't think we need to worry much about optimizing this regex. :)
^_^ Just don't want the regex engine to pointlessly backtrack over
something so simple.
Soo...
/^\s*(\S+|`[^`]+`)(\s*\.\s*(\S+|`[^`]+`))?\s*$/iS
I do want to use an S flag since it's going to be used very often...
^_^ I'll commit this to trunk and port it into a 1.12 patch I'm hosting
yet again... Well, once I'm not dazed enough by sleep I only have a
partial understanding about how my own regex works, heh...
http://wiki-tools.com/wiki/Shared_Tables_in_1.12
^_^ How else do you think I'm using shared interwiki when I only have 2
wiki on 1.13... Ok, actually... I only have 1 wiki on 1.13... ^_^ The
other one is on the titlerewrite branch... Which as you can see, is
horribly broken... ie: Needs work, heh...
http://titlerewrite.dev.wiki-tools.com/wiki/Main_Page
Plus... I need to setup cron to bring over changes from the branch.
_______________________________________________
Wikitech-l mailing list
Wikitech-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
~Daniel Friesen(Dantman) of:
-The Gaiapedia (
http://gaia.wikia.com)
-Wikia ACG on
Wikia.com (
http://wikia.com/wiki/Wikia_ACG)
-and
Wiki-Tools.com (
http://wiki-tools.com)