Stefan Kyrytow wrote:
: As you can see the last two inputs should not be accepted. I am using $x =~
: /[0-9]/ as my filter. I understand why the values are being accepted, I am
: searching for a number and 12bob & bob12 each contain a number.
: 
: What I do not understand is how to search for just a number.

Nail the regex down to match at the beginning and end of the input string:

/^[0-9]+$/

or, equivalently, 

/^\d+$/

^ matches the beginning of the string
$ matches the end fo the string

If the string contains anything but digits, the match will fail.

-- tdk

Reply via email to