This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
reginald /
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Sun Dec 06 11:40:11 -0800 2009 | |
| |
LICENSE | Sat Nov 07 13:53:35 -0800 2009 | |
| |
README.rdoc | Sun Dec 06 12:24:37 -0800 2009 | |
| |
Rakefile | Sun Dec 06 11:46:04 -0800 2009 | |
| |
benchmark/ | Sat Dec 05 09:35:10 -0800 2009 | |
| |
lib/ | Sun Dec 06 12:09:18 -0800 2009 | |
| |
reginald.gemspec | Sun Dec 06 11:40:11 -0800 2009 | |
| |
spec/ | Sat Dec 05 11:00:24 -0800 2009 |
README.rdoc
Reginald
Reginald is a Ruby Reginald syntax parser. Its parser and tokenizer are written in racc/rexical. Since racc is part of Ruby’s standard library, there are extra runtime dependencies.
Examples
Determine if a Regexp could be treated as a literal String
Reginald.parse(/foo/).literal? # => true Reginald.parse(/ba./).literal? # => false
Determine whether a character could match a part of a Regexp
Reginald.parse(/foo\/bar/).include?("/") # => true
Reginald.parse(/foo.bar/).include?("/") # => true
Reginald.parse(/foo[a-z]bar/).include?("/") # => false
Extract a substring of a Regexp
Reginald.parse(/foobar/)[3..6] => #<Expression "bar">
Reginald.parse(/fo{2}[bB]ar/)[2..5] => #<Expression "[bB]ar">







