Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^5: Filtering unwanted chars from input field

by Anonymous Monk
on Dec 19, 2012 at 20:51 UTC ( [id://1009634]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Filtering unwanted chars from input field
in thread Filtering unwanted chars from input field

What is I want to allow spaces as well? \s+ does not work.
  • Comment on Re^5: Filtering unwanted chars from input field

Replies are listed 'Best First'.
Re^6: Filtering unwanted chars from input field
by johngg (Canon) on Dec 19, 2012 at 23:18 UTC

    The left hand side of the tr is not a regular expression. Just include a real space in the character list.

    $ perl -E ' > @data = ( > q{Hello, world!}, > q{te-st%$/*.}, > q{All_of_this_is_OK.}, > q{!@#$%^&*()12345}, > ); > say for map { tr{A-Za-z0-9_. -}{}cd; $_ } @data;' Hello world te-st. All_of_this_is_OK. 12345 $

    Cheers,

    JohnGG

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-24 18:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found