Regular Expression Performance

  • Thread starter Thread starter Phil396
  • Start date Start date
P

Phil396

I have a long string I will perform multiple
searches on. If I convert the string to lower case
and perform the regex search will that help
the perfomance of the application ?


Any Regex performance tips would help, except
creating Regex Assemblies. I have enough information
on that subject.
 
The best tip is to avoid backtracking. That means using the non-greedy
matches when you are matching short strings, and greedy ones when you are
matching long ones (usually - you do have to measure).

You should also consider whether you could write your pattern to do more
than one search at a time, so you limit the number of trips through the
string.

--
Eric Gunnerson

Visit the C# product team at http://www.csharp.net
Eric's blog is at http://weblogs.asp.net/ericgu/

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top