Solved

perl module to debug regular expression

Posted on 2014-12-26
5
110 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
  • 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

Suggested Solutions

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

726 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