note 102049 added to function.preg-replace
| From: | cryptoncorp at gmail dot com | Date: | Tue, 25 Jan 2011 09:07:00 +0000 |
| Subject: | note 102049 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-176276@lists.php.net to get a copy of this message | ||
I have this code!
------------------------------------------------------------
<?php
$amount = $_POST['amount'];
// replace anything that's NOT 0-9 with "null" (nothing)
$result=preg_replace('/[^0-9^A-Z^a-z-*&%$ ,;_!@.{}#]/', '<br/>',
$amount);
echo $result;
?>
<form method="post" action="">
<input id="amount" name="amount" size="100"
type="textbox" value="Driver,.;_-{}*&%$#[] Genius Professional Edition
10.0.0.526/Driver Genius Professional Edition 10.0.0.526.exe">
<input type="submit" value="Submit">
</form>
------------------------------------------------------------
Output
------------------------------------------------------------
Driver,.;_-{}*&%$#
Genius Professional Edition 10.0.0.526
Driver Genius Professional Edition 10.0.0.526.exe
------------------------------------------------------------
The output i want
------------------------------------------------------------
Driver,.;_-{}*&%$#[] Genius Professional Edition 10.0.0.526
Driver Genius Professional Edition 10.0.0.526.exe
------------------------------------------------------------
Can someone help me with this! What i want is to add an exception for this []. But when i insert it
directly into my code it did not work for me! Please help me with this!
----
Server IP: 69.147.83.197
Probable Submitter: 203.192.200.204
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- https://master.php.net/note/edit/102049
Del: integrated -- https://master.php.net/note/delete/102049/integrated
Del: useless -- https://master.php.net/note/delete/102049/useless
Del: bad code -- https://master.php.net/note/delete/102049/bad+code
Del: spam -- https://master.php.net/note/delete/102049/spam
Del: non-english -- https://master.php.net/note/delete/102049/non-english
Del: in docs -- https://master.php.net/note/delete/102049/in+docs
Del: other reasons-- https://master.php.net/note/delete/102049
Reject -- https://master.php.net/note/reject/102049
Search -- https://master.php.net/manage/user-notes.php