sanuk
07-28-2002, 12:41 PM
Hi Friends,
I need a method for cleaning strings from all NON alphabetic and numeric characters that are submitted by a form
I have the following strings:
$data1 - $data2 and $data3
before writing these 3 strings to file, I want to eleminate all characters that are not a-z, A-Z and 0 to 9 and replace them with nothing, not even a blank.
Meaning if $data1 = "my tel # 025/123.895.548"
should become $data1 = "my tel 025123895548"
Then I need the same as above but also eleminating blank spaces
such as:
$data5 = "map &125 #abc <small"
becomes
$data5 = "map25abcsmall"
And to make things even worse I need a very difficult one
That eleminates everything that is not a number or a decimal point.
$data6 = "Temperature for city $manoi <b>40.08</b> celcius"
becomes
$data6 = "40.08"
Best Regards,
Sanuk
I need a method for cleaning strings from all NON alphabetic and numeric characters that are submitted by a form
I have the following strings:
$data1 - $data2 and $data3
before writing these 3 strings to file, I want to eleminate all characters that are not a-z, A-Z and 0 to 9 and replace them with nothing, not even a blank.
Meaning if $data1 = "my tel # 025/123.895.548"
should become $data1 = "my tel 025123895548"
Then I need the same as above but also eleminating blank spaces
such as:
$data5 = "map &125 #abc <small"
becomes
$data5 = "map25abcsmall"
And to make things even worse I need a very difficult one
That eleminates everything that is not a number or a decimal point.
$data6 = "Temperature for city $manoi <b>40.08</b> celcius"
becomes
$data6 = "40.08"
Best Regards,
Sanuk