On Wed, 8 Sep 2004, Simon Strandgaard wrote:

> Debugging regular expressions becomes easier with this package.
>
> Here is a few examples of how to debug regexp's:
>
> bash-2.05b$ irb
> irb(main):001:0> require 'regexp'
> => true
> irb(main):002:0> puts /a.{2,4}c/.tree
> +-Sequence
>  +-Inside set="a"
>  +-Repeat greedy{2,4}
>  | +-Outside set=U-000A
>  +-Inside set="c"
> => nil
> irb(main):003:0> puts /[^0-9]/.tree
> +-Outside set="0".."9"
> => nil
> irb(main):004:0> puts /\w+@\w+\.((com)|(net)|(org))/.tree
> +-Sequence
>  +-Repeat greedy{1,-1}
>  | +-Inside set=["0".."9", "a".."z", "A".."Z", "_"]
>  +-Inside set="@"
>  +-Repeat greedy{1,-1}
>  | +-Inside set=["0".."9", "a".."z", "A".."Z", "_"]
>  +-Inside set="."
>  +-Group capture=1
>    +-Alternation
>      +-Group capture=2
>      | +-Sequence
>      |   +-Inside set="c"
>      |   +-Inside set="o"
>      |   +-Inside set="m"
>      +-Group capture=3
>      | +-Sequence
>      |   +-Inside set="n"
>      |   +-Inside set="e"
>      |   +-Inside set="t"
>      +-Group capture=4
>        +-Sequence
>          +-Inside set="o"
>          +-Inside set="r"
>          +-Inside set="g"
> => nil
> irb(main):005:0>


wow - that is very cool simon!  i can't remember is this dfa or nfa re?

-a
--
===============================================================================
| EMAIL   :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE   :: 303.497.6469
| A flower falls, even though we love it;
| and a weed grows, even though we do not love it. 
|   --Dogen
===============================================================================