T
Tom
I have struggled with the issue of wether or not to useRegular
expression thing for a long time. And after implementing many text
manipulating solutions both ways, I've found that writeing spicialized
code instead of an RE is almost always the better solution. Here is
why....
RE's are complex. Sure it is one line of code, but is is on hell of a
line. Some of my RE remind me of the obfuscated code contest winners,
where one line of cryptic characters generates the 12 days of
christmas. After you have worked out the complex RE it is almost
immpossible for anyone(includeing yourself) to figure out what it is
really doing. Less code in not necessarily simple code. Plus it is not
like writing this "one line" of code is saving you any time. I have
had really complex RE's that took me hours to write that I needed
external tools to help me with. Sure it was only one line of code in
the end, but I could have written a page of easy to follow code in
half the time. Which brings me to my next point.
RE's are not debugable. If I have a page of well written code I (or
anyone else) can easily step through it. When I send my 150 char RE
into the RE engine it is a black box. I am just left to wonder why it
didn't work.
Now I am sure you RE masters are out the just calling me a
Dumb***,Just learn RE better and you won't have any problems. But the
reality is that I can assume that anybody looking at my is proficient
in C++, because it is a C+++ Program, I can't assume that they are a
RE Guru.
It's difficult to do some things in RE. RE's work great for some
searchsbut not so well for others. I usually find myself having to get
a bunch of results back then doing some other processing on them get
get the text out, which mean special code anyways.
Finally I don't know what you guy are saying about RE ever being fast.
In my experience RE's are slow, very slow. Like on the order of 10
times slower then straight forward string parsing code. For me this is
the final kicker. Orginally I went through all the trouble off using
RE's in all my complex text paring code because I thought it would
faster. This could be a result of .NET engine, regradless I was
really dissapointed by this causing me to rollback a lot of my
solutions.
With all this said I stil use REs sometimes, but only for really
simple string operations where I can come up with the expression in a
couple of seconds I don't care about performance and don't feel like
writeing 5-10 lines of code. Kind of like a quick hack.
Thats my 2 bits.
Thomas
expression thing for a long time. And after implementing many text
manipulating solutions both ways, I've found that writeing spicialized
code instead of an RE is almost always the better solution. Here is
why....
RE's are complex. Sure it is one line of code, but is is on hell of a
line. Some of my RE remind me of the obfuscated code contest winners,
where one line of cryptic characters generates the 12 days of
christmas. After you have worked out the complex RE it is almost
immpossible for anyone(includeing yourself) to figure out what it is
really doing. Less code in not necessarily simple code. Plus it is not
like writing this "one line" of code is saving you any time. I have
had really complex RE's that took me hours to write that I needed
external tools to help me with. Sure it was only one line of code in
the end, but I could have written a page of easy to follow code in
half the time. Which brings me to my next point.
RE's are not debugable. If I have a page of well written code I (or
anyone else) can easily step through it. When I send my 150 char RE
into the RE engine it is a black box. I am just left to wonder why it
didn't work.
Now I am sure you RE masters are out the just calling me a
Dumb***,Just learn RE better and you won't have any problems. But the
reality is that I can assume that anybody looking at my is proficient
in C++, because it is a C+++ Program, I can't assume that they are a
RE Guru.
It's difficult to do some things in RE. RE's work great for some
searchsbut not so well for others. I usually find myself having to get
a bunch of results back then doing some other processing on them get
get the text out, which mean special code anyways.
Finally I don't know what you guy are saying about RE ever being fast.
In my experience RE's are slow, very slow. Like on the order of 10
times slower then straight forward string parsing code. For me this is
the final kicker. Orginally I went through all the trouble off using
RE's in all my complex text paring code because I thought it would
faster. This could be a result of .NET engine, regradless I was
really dissapointed by this causing me to rollback a lot of my
solutions.
With all this said I stil use REs sometimes, but only for really
simple string operations where I can come up with the expression in a
couple of seconds I don't care about performance and don't feel like
writeing 5-10 lines of code. Kind of like a quick hack.
Thats my 2 bits.
Thomas