The Snippets Thread
10-20-2011, 09:37 AM,
#4
RE: The Snippets Thread
Here's one of the ones I find extremely useful when parsing user input. It's a regex function that takes all non-numeric characters out of a string. [source]
PHP Code:
preg_replace('/\D/'''$string
Of course, you can replace the D with other regex strings, like [a-zA-Z] to remove all non alphabetic characters, or [a-zA-Z0-9] to remove all alphanumeric characters.
Hi! I'm Zach, and I founded NiftyHost. If you need anything, just PM me! :)
Reply


Messages In This Thread
The Snippets Thread - by MyDigitalpoint - 08-15-2011, 12:00 PM
RE: The Snippets Thread - by HiddenKnowledge - 10-02-2011, 11:35 PM
RE: The Snippets Thread - by MyDigitalpoint - 10-20-2011, 08:24 AM
RE: The Snippets Thread - by Zach - 10-20-2011, 09:37 AM
RE: The Snippets Thread - by Arthur - 10-27-2011, 01:40 PM
RE: The Snippets Thread - by Zach - 10-27-2011, 02:42 PM
RE: The Snippets Thread - by Arthur - 10-27-2011, 09:01 PM
RE: The Snippets Thread - by Serial Thrilla - 01-18-2012, 02:33 AM
RE: The Snippets Thread - by Arthur - 04-12-2012, 07:28 AM

Forum Jump: