S
Simon Strandgaard
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>
So how do you install this wonderful program...
The recommended way is via RPA..
download-rpa:
http://rubyforge.org/frs/?group_id=265&release_id=760
rpa update
rpa install rpa-base
rpa install re
sidenode: actually this package is a fullblown regexp engine.. but thats
another story.
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>
So how do you install this wonderful program...
The recommended way is via RPA..
download-rpa:
http://rubyforge.org/frs/?group_id=265&release_id=760
rpa update
rpa install rpa-base
rpa install re
sidenode: actually this package is a fullblown regexp engine.. but thats
another story.