Re: Need Regular Expressions?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: John Nurick (j.mapSoN.nurick_at_dial.pipex.com)
Date: 02/14/05


Date: Mon, 14 Feb 2005 20:22:20 +0000

I'm perfectly happy with regexes in a production situation, and have
never heard of problems caused by using the VBScript regular expression
object in VBA code (my own testing has included running queries that
create and destroy a regex object millions of times in order to see if
there are memory or resource leaks).

It's also worth noting that the .Net framework includes a regex engine
(whose regexes are a superset of those available in VBScript).

Here are a couple of links to get started:
http://msdn.microsoft.com/library/en-us/script56/html/reconintroductiontoregularexpressions.asp?frame=true
http://msdn.microsoft.com/library/en-us/script56/html/vtoriregularexpressionsobjectpropmeth.asp?frame=true

The book Mastering Regular Expressions by Jeffrey Friedl (O'Reilly) is
the nearest there is to a standard text; I don't think it specifically
discusses the VBScript regex engine, but most of it will work anyway.
Likewise the O'Reilly Regular Expression Pocket Reference.

On Mon, 14 Feb 2005 10:53:02 -0800, alr <alr@discussions.microsoft.com>
wrote:

>Thanks for your input. I got things working but now I am working on a more
>permanent solution. I need to save the removed text to a new field and run
>this on some large quantities of data in a production environment.
>
>Is there a better choice of tools or some suggestions for making the regex
>reliable? Obviously rigorous and thorough testing of any solution is
>required. If regex is the best choice, is VBA to VbScript to Regex an
>acceptable way to get there? Are there other options? Is there some
>documentation available? The lack of a manual for these tools has become a
>major irritant in my life or a job security program.
>
>Thanks again,
>
>alr
>
>
>
>
>
>
>"John Nurick" wrote:
>
>> On Wed, 9 Feb 2005 09:39:02 -0800, alr <alr@discussions.microsoft.com>
>> wrote:
>>
>> >Of course this was at my expense since I must maintain this code. Any clues
>> >on how to keep it simple?
>>
>> If you don't let them change the rules you won't have to change the
>> code.
>>
>> IME it's easier to maintain one regex than the tens or hundreds of lines
>> of code that would otherwise be needed to implement the same rules. (And
>> the nice people who design and build regex engines must feel the same
>> way or they'd spend their time doing something else.)
>>
>> Pace Maury, it's not regexes that are error prone but the people who
>> write them (me included). It's all too easy to develop a regex that
>> seems to do the job, and then move on to something else without testing
>> it thoroughly. Later on, with unexpected input, it may give you
>> unexpected output - but that means it's wrong, not broken<g>.
>>
>> --
>> John Nurick [Microsoft Access MVP]
>>
>> Please respond in the newgroup and not by email.
>>

--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.


Relevant Pages

  • Re: Interacting with c++ (Boost) Libraries
    ... I'm wondering if anyone has done any work on accessing the Boost ... a regex engine, I'm looking at boost as a potential alternative). ... you already have a Regular Expression component. ... References and seek out "Microsoft VBScript Regular Expressions 5.5" ...
    (microsoft.public.vb.winapi)
  • Re: Interacting with c++ (Boost) Libraries
    ... I'm wondering if anyone has done any work on accessing the Boost ... a regex engine, I'm looking at boost as a potential alternative). ... you already have a Regular Expression component. ... References and seek out "Microsoft VBScript Regular Expressions 5.5" ...
    (microsoft.public.vb.winapi)
  • Re: Regex question
    ... It's hard to help you with the actual regex, ... regexes, is to split them across a few lines of code to improve ... Each line would have a part of the string you're trying to match. ... yourself) read back a regular expression. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: how to avoid leading white spaces
    ... motivates my use of regexes. ... You are right that for a simple .startwithusing a regex "just ... That's because you know regex syntax. ... I didn't see anything about de-emphasizing them in Perl. ...
    (comp.lang.python)
  • Re: how to avoid leading white spaces
    ... complex hard-coded replacement for a regex. ... I would not recommend you use a regex instead of a string method ... be a reaction to their frequent use in Perl. ... With regexes the code is likely to be less brittle than ...
    (comp.lang.python)