Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Think about Loose Coupling
 
PerlMonks  

Re: The Perl Regex Tester

by Anonymous Monk
on Jul 03, 2012 at 20:40 UTC ( #979784=note: print w/ replies, xml ) Need Help??


in reply to The Perl Regex Tester

Neato

Well, you force user to add text because it won't match against default text -- i don't know if this is how placeholder attribute works or if you want that -- it confused me for a second :)

For some interface ideas (future jquery potential) see Visual (perl/Tk) regex tweaking utility (its like a living cheatsheet) and Re: validate a form field with regexp?

Also curious, I read that you can use (?{print}) for debugging, I think Regexp::Grammars must do that


Comment on Re: The Perl Regex Tester
Re^2: The Perl Regex Tester
by davido (Archbishop) on Jul 03, 2012 at 20:56 UTC

    I've read MJD's paper on Using (?{print}) for debugging, but it seems imprudent to enable use re qw(eval) in the context of executing user regexes. Since I'm not certain that I could sanitize the regex well enough to feel good about re 'eval', I'll have to pass on that technique.

    That Tk snippet was interesting. As for Re: validate a form field with regexp?, I could see allowing someone to use English to enter a regex, and then see what it looks like in "indistinguishable from line noise" format. I'll give that some thought.

    I thought my code prevented zero-length regexes, but not zero-length targets. I'll look into it and get that fixed. In fact, I should probably allow zero-length regexes too, but (?:) is essentially the same thing.

    Thanks for your input.

    Update:After looking at Your failed match, I am not sure that there's an issue. It seems to be correctly stating "No Match!", as (\b\w+) shouldn't match against an empty string. I could be misunderstanding.

    The linking feature was an afterthought, and I'm already glad I added it. I see that as being useful.


    Dave

      I could be misunderstanding.

      When I with my eyes look at the form it says "Target string", sure its a little greyed out, I expected the regex I typed to match against "Target string" not empty string :)

        Oh, I see. ...yes, that's an HTML5 placeholder. Do you think I should do away with it?


        Dave

Re^2: The Perl Regex Tester
by thundergnat (Deacon) on Jul 05, 2012 at 16:13 UTC
      Your Visual Regex Explorer link says:
      Uses YAPE::Regex::Explain to give detailed explanations of what any valid regex. (As long as it doesn't use any of the extensions added in perl 5.12 or later. That's a limitation of Y::R::E. If it gets updated, then so will VRegExp.)

      YAPE::Regex::Explain says:

      There is no support for regular expression syntax added after Perl version 5.6, particularly any constructs added in 5.10.

        Ermm... so it does. Either a reading fail on my part, or an unnoticed typo. I'll change the readme. Thanks.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://979784]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2014-04-17 10:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (444 votes), past polls