Re: Regex optimization
- From: Chris Shepherd <chsh@xxxxxxxxxxxxxx>
- Date: Wed, 26 Sep 2007 10:15:25 -0400
Chuck B wrote:
Yes I will - but then that won't tell me much about what went on internally.
I was hoping that someone with knowledge of the Regex engine could help me understand why one was better than the other.
Thanks for your help. Oh wait... nm... ;)
Trying it for yourself and seeing the results is a perfectly reasonable answer.
While it may not allow you to recreate the source code, it certainly will tell you which way is more efficient. Because your original regexes were completely unequal, it's hard to say whether you could actually learn anything about what is going on "internally" since in one instance you'd get a LOT more hits than the other.
Assuming a somewhat normal dataset where some records have "The quick brown fox" and more records have "The" in them, I'd suggest that it's probably more work to return more results than it is simply to find them, so #1 wins out. On 10,000 lines of "The quick brown fox" where the returned values would be equal, I'd wager on the second regex being faster (equal time spent returning values, less time spent searching).
Chris.
.
- Follow-Ups:
- Re: Regex optimization
- From: Chuck B
- Re: Regex optimization
- References:
- Regex optimization
- From: Chuck B
- Re: Regex optimization
- From: Stephany Young
- Re: Regex optimization
- From: Chuck B
- Regex optimization
- Prev by Date: Re: Tab Order tool
- Next by Date: Filtering ListViewItems
- Previous by thread: Re: Regex optimization
- Next by thread: Re: Regex optimization
- Index(es):