Re: Are Regex slower than methods from classes like String & Char?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi,

<ommail@xxxxx> wrote in message
news:1179926819.565737.173210@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi

I wonder if regular expressions are in general sower than using
classes like String and
Char when used for validating/parsing text data?

I've done some simple test (using IsMatch()) method and the result was
that Regex
is either as fast or two times slower than method which used methods
from classes
String and Char.
(I tried static and object method, I also tried Compiled option)

Maybe Regex are slower only when matching is relatively simple?

That's correct.

The good thing about Regex is when you have something else but trivial
pattern, the expressivity you get with the Regex is imposible to get using
other means.


.



Relevant Pages

  • Re: Search for multiple things in a string
    ... >>> As far as readability, it has nothing to do with Regular Expressions ... > and Regex. ... >> characters in the string, perhaps even writing your own state machine ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: String.replaceAll wont work :s
    ... the String#replaceAllmethod expects a regular expression (regex) ... function (just like in java Strings). ... The second parameter is no regex, but only the String which ... For more information about regular expressions, ...
    (comp.lang.java.help)
  • Re: regex test failing in form validation
    ... If you have debug on you'll see a decent report of what the code is ... The regex for matching correct protocol and TLD for the URL ... This will search for the string "TLDlist". ... neither in strings nor regular expressions. ...
    (comp.lang.javascript)
  • Re: Regular Experssion
    ... that regular expressions are so powerful, how come Cor was able to whip up a ... didn't whip up a regex example to show how much faster and cooler regex is? ... <flame off> ... especially if search and match string are long. ...
    (microsoft.public.vstudio.general)
  • Re: Regular Experssion
    ... that regular expressions are so powerful, how come Cor was able to whip up a ... didn't whip up a regex example to show how much faster and cooler regex is? ... <flame off> ... especially if search and match string are long. ...
    (microsoft.public.dotnet.general)