Here's a short one-liner that will let you interactively test a regex from the command line. You supply the regex as an argument and then you subsequently type in strings. It will print "Yes" for a match, and "No" for a non-match.
perl -lpe'BEGIN{$r=pop} $_=/$r/?"Yes":"No"' your_regex_here
Or for Win32:
perl -lpe"BEGIN{$r=pop} $_=/$r/?'Yes':'No'" your_regex_here

Replies are listed 'Best First'.
Re: Interactively Test Regexes
by Aristotle (Chancellor) on Mar 16, 2003 at 00:21 UTC
    To make it a little more interesting:
    perl -lpe'BEGIN{$r=pop} $_=/$r/?"Yes, $&":"No"' your_regex_here

    Makeshifts last the longest.

Re: Interactively Test Regexes
by halley (Prior) on Apr 11, 2003 at 14:18 UTC

    I can imagine a little CGI HTML/CSS page which would make this a more visual process.

    Show the pattern, and show the sample string. For each token in the regex, or just for each grouping set of parens, wrap both the regex and the subsequent sample string with <span style=...> tags that set the background colors for each range.

    --
    [ e d @ h a l l e y . c c ]

Re: Interactively Test Regexes
by Murcia (Monk) on Aug 05, 2003 at 15:35 UTC
    How to run it? when I run it on command line, I get cannot find file ...