Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-20-2012, 09:49 AM   PM User | #1
capypara
New Coder

 
Join Date: Aug 2011
Posts: 49
Thanks: 1
Thanked 0 Times in 0 Posts
capypara is an unknown quantity at this point
Regular expression

Hi all, i am trying to search an input string for any occurrences of any special characters, but it does not seem to work.

//$data is what the user input, for testing site security purposes i am inputting the following value without the front slashes
//var site_url = "<?php echo base_url();?>";
if (preg_match("/[\<\>\\\.\+\*\?\^\$\[\]\(\)\|\{\}\/\'\#]/", $data))
{
//do something here
}

The if loop never turns out true; is there something wrong with my regular expression? Or am i using the wrong function?
capypara is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:42 PM.


Advertisement
Log in to turn off these ads.