Eric J. Smith wrote:
> Stefan,
>
> Most of the regular expressions posted so far are going to be very slow on
> large files. They are using positive look behinds which means that for
> every single word boundary in the entire file, the regex engine will look
> behind that word to see if your positive look behind matches. For instance,
> take the .h regex:
>
> (?<=class[\s])\b\w+\b
>
> Rather than forcing the regex engine to consider every single \b (word
> boundary), what would be way more efficient is to look for instances of
> "class" and begin matching there. There should be a hell of a lot less
> instances of class as opposed to \b (start of a word).
>
> Also, the whole double pass regex doesn't make a lot of sense to me either.
> Why not just use captured groups inside of a single regex? Something like
> this would work just fine for your .h regex:
>
> class\s+(\w+)
>
> Notice the parens around \w+, that will cause the regex engine to capture
> whatever the \w+ matches to a captured group. Then in your code you take
> the matches returned by the regex and add all captured groups to the
> auto-complete list. This totally skips the second regex pass, has the same
> result, and keeps you from doing slow positive look behinds.
I'm now a little confused: do you suggest changing the code in TSVN or
just the regex patterns?
You seem to be very good with regexes, so you maybe can help improving
those strings a lot - I haven't used regexes that much yet...
Stefan
--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest Interface to (Sub)Version Control
/_/ \_\ http://tortoisesvn.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Wed Feb 16 21:11:24 2005