Is there Perl's YAPE::Regex::Explain alternative to python?

Posted by S.Mark on Stack Overflow See other posts from Stack Overflow or by S.Mark
Published on 2010-04-30T07:44:32Z Indexed on 2010/04/30 7:57 UTC
Read the original article Hit count: 198

Filed under:
|
|

Is there Perl's YAPE::Regex::Explain alternative to python?

For example, which could do following regex

\w+=\d+|\w+='[^']+'

to explanations like this

  NODE                     EXPLANATION
--------------------------------------------------------------------------------
  \w+                      word characters (a-z, A-Z, 0-9, _) (1 or
                           more times (matching the most amount
                           possible))
--------------------------------------------------------------------------------
  =                        '='
--------------------------------------------------------------------------------
  \d+                      digits (0-9) (1 or more times (matching
                           the most amount possible))
--------------------------------------------------------------------------------
 |                        OR
--------------------------------------------------------------------------------
  \w+                      word characters (a-z, A-Z, 0-9, _) (1 or
                           more times (matching the most amount
                           possible))
--------------------------------------------------------------------------------
  ='                       '=\''
--------------------------------------------------------------------------------
  [^']+                    any character except: ''' (1 or more times
                           (matching the most amount possible))
--------------------------------------------------------------------------------
  '                        '\''

© Stack Overflow or respective owner

Related posts about perl

Related posts about regex