Hi AVL,
Just to clear things up regarding regular expressions versus string
functions. Use regular expressions when looking for a *pattern* of
characters in a string, which may be different characters in the same
pattern, and string functions for looking for substrings. What I mean by
"patterns" is, for example, a hyperlink in an HTML document.
A hyperlink is a string that must follow certain rules. It must begin with
the character sequence "<a" followed by one or more white space characters,
followed by 0 or more attribute name=value pairs, followed by the ">"
character. This is followed by a string of text that is followed by the
"</a>" character sequence. Note that only several of the characters are
specified, and you don't know what the rest of them will be. So, how do you
look for a string that satisfies these rules? Example:
(?m)(?i)(?<=<a)(?
?:\s+href=(?<href>[^>]+))|(?:\s+[^=>]+=[^>]+))*>(?<innerHtml>[^<]*)(?=</a>)
The above is a regular expression that identifies substrings that satisfy
those rules. In addition, it captures 2 groups, one for the link text, one
for the innerHtml of the anchor.
You could not use a string function to find this pattern. Generally, string
functions are faster than regular expressions, but when looking for patterns
(groups of characters that satisfy rules), regular expressions are the
fastest method.
--
HTH,
Kevin Spencer
Microsoft MVP
Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net