Re: Splitting a String

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



Ludwig <none@xxxxxxxx> wrote:
And this is a good example of why you should really think about whether
regular expressions are the right solution before using them. Pretend
you don't know what the bit of code is meant to do, and read the
version above. Then read Nick's version using String.Substring. I know
which I find significantly simpler to understand...

I agree! The format is well-known, so RegEx is not the best and most
simple solution. Of course, if you are a regular expressions expert,
this piece of code may be just as simple as using SubString...

Only if you can assume that *everyone* who is going to read/maintain
the code is as happy with regular expressions. Don't forget that code
spends more time being maintained than being written - and it's often
maintained by different people.

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.



Relevant Pages

  • Re: Cannot replace parenthesis using regex.replace?
    ... Is there a real performance difference between the two or I just wasted 3 ... > of the special features of regular expressions, ... > If replying to the group, please do not mail me too ...
    (microsoft.public.dotnet.general)
  • Re: Cannot replace parenthesis using regex.replace?
    ... Kyle has answered your question - but do you actually have any need to ... of the special features of regular expressions, ... If replying to the group, please do not mail me too ... Prev by Date: ...
    (microsoft.public.dotnet.general)
  • Re: Regular Expression Question
    ... > straight forward tutorial that doesn't take days to read through. ... > bought the O'Reilly Regular Expressions book when I was doing some Perl ... If replying to the group, please do not mail me too ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Regular Expression - More learning
    ... Working out when to use regular expressions and when to use ... I'll have a look at the regex ... If replying to the group, please do not mail me too ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)