in reply to Re^3: Stopping bad input (harder than sanitizing)
in thread Stopping bad input (harder than sanitizing)

Here is something new: I also wanna catch '[' (for [(1)). But when my expression is $_1 =~ /^[\w\s:-\[]+/ it spits out an error and says "stack moved" (is that PERL humor?). How do I add '[' to the character class? When I press <RET> with no data, the program still locks up.

  • Comment on Re^4: Stopping bad input (harder than sanitizing)

Replies are listed 'Best First'.
Re^5: Stopping bad input (harder than sanitizing)
by hippo (Archbishop) on Mar 10, 2021 at 18:48 UTC

    The hyphen in the middle is significant. Move it to the end if you want it to be a literal.


    🦛

Re^5: Stopping bad input (harder than sanitizing)
by tybalt89 (Monsignor) on Mar 10, 2021 at 19:08 UTC

    Please put perl code inside code tags, it's not possible to tell just what you entered.