I have a form with a textbox and I already have a "smut engine" script which turns bad words into ******.
What I would like to do is prevent people entering telephone numbers, and similarly turn them into *******. What I have in mind is that a phone number is recognised as being 8 consecutive digits but including blanks or hyphens.
E.G. 1234 5678 or 1234-5678 or 012-345-6789 recognised as phone numbers.
I don't seem to be having much success in developing a working script. Can anyone point me the right way?
Thanks jkd. I want to mask the phone numbers, that is replace them with asterisks. I do not want to validate them, but I am assuming that any string of eight or more consecutive digits (plus blanks and hyphens if any) entered into the text box is a phone number, and thus to be masked.
But I don't want to mask all numeric input - just strings of numbers which are or might be telephone numbers. That is, 8 or more consecutive digits.
To spell it out, I do not want people to be able to post things like
"Earn lots of money with my MLM scheme - telephone 1234-5678".
but (for example) things like "Price $1234.56" or "serial number 987654" are OK.
I do not want to store their real phone number.
Hope I have clarified the objective!
By the way, only spaces and hyphens in the numeric string should be counted. This is because something like "1984/85/86/87" is OK. I realise that my idea will block the dates "1985-1986" for example, but this is not a serious problem in the context.
So to recap: 1995/96/97/98 is OK
$1,234,567,891 is OK
1234-5678 or 123-4567-8912 are not and to be masked out with *.
P.S. If it matches, you can use the above code to replace any numbers with * - but anyone who is savvy will figure that out, and figure out a way around it. You can only do so much... I think that in this case you might want to hire a kid to do this for cheap.
__________________
Former ASP Forum Moderator - I'm back!
If you can teach yourself how to learn, you can learn anything. ;)