T
Tony Johansson
Hi!
I just wonder when is it better to use regular(Regex) expression then to use
substring ?
//Tony
I just wonder when is it better to use regular(Regex) expression then to use
substring ?
//Tony
Tony said:Hi!
I just wonder when is it better to use regular(Regex) expression then to use
substring ?
Harlan Messinger said:The only time it's better to use a regular expression than substring is
when substring isn't applicable--that is, when what you're trying to match
isn't a fixed string. You wouldn't bother with a regular expression just
to find out if a string contains the substring "foo" somewhere inside it.
Tony said:If I just ask in general when should I use regular expression instead of
doing the same thing with classes
I just wonder when is it better to use regular(Regex) expression then to use
substring ?
Harlan Messinger said:Then I'm afraid I don't understand the question. Regular expressions are a
way to express a character-based pattern. They're used to confirm that a
string matches, or to locate strings that match, a pattern (assuming the
pattern *can* be expressed as a regular expression--not all string
patterns can). What do you mean by doing "the same thing" with classes?
In .NET we have a framework that consist of a lot of classes. these classes
can be used when
we want to change the state of an object. So in almost every case whan you
will use a regex you can almost always do the same this by using the classes
that exist in the framework but the code will be greater then using regex.
Hope you understand what I mean.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.