Solved

perl module to debug regular expression

Posted on 2014-12-26
5
113 Views
Last Modified: 2015-02-08
I use regexpal / Data::Dumper / YAPE::Regex to test regex and references.

I spend lot of time to debug when lazy / greedy quantifier is involved (such as  .+? vs .* and so on ). It works in regexpal but does not in the code.

In short - Is there a perl module to debug regex? I searched in cpan but haven't been able to find anything.
0
Comment
Question by:Mazdajai
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 40519009
perl -d
runs the Perl debugger, see
perldoc perldebug

Did you have a specific test you want to want to perform?
0
 
LVL 21

Author Comment

by:Mazdajai
ID: 40519015
Yes there are couple regular expression that do not work although they works perfectly fine in regexpal.

Thanks for the doc  - Would the following help?

V [pkg [vars]]

Display all (or some) variables in package (defaulting to main ) using a data pretty-printer (hashes show their keys and values so you see what's what, control characters are made printable, etc.). Make sure you don't put the type specifier (like $ ) there, just the symbol names, like this:

    V DB filename line

Use ~pattern and !pattern for positive and negative regexes. 

Open in new window

0
 
LVL 84

Accepted Solution

by:
ozo earned 450 total points
ID: 40519030
the V command in the debugger will help if you don't know what variables you have in your package.
but if you know what variables you want to look at, the p or x commands may be more useful.
0
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 50 total points
ID: 40519836
Keep in mind that all regex implementations are different. They work differently and most support different syntaxes. Regex is not guaranteed to be portable. RegexPal uses Javascript's regex engine. This is not the same engine that Perl uses.
0
 
LVL 21

Author Comment

by:Mazdajai
ID: 40596957
I couldn't get debugger to work and other projects came along and put this behind. Perhaps some days I will open a new question if I need to troubleshoot regex again.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been reconstructing a PHP-based application that has grown into a full blown interface system over the last ten years by a developer that has now gone into business for himself building websites. I am not incredibly fond of writing PHP code o…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Six Sigma Control Plans

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question