Re: preg_match problem
| From: | Richard Lynch | Date: | Thu, 25 Jan 2007 23:40:33 +0000 |
| Subject: | Re: preg_match problem | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-247799@lists.php.net to get a copy of this message | ||
On Thu, January 25, 2007 9:53 am, Jim Lucas wrote:
> http://www.cmsws.com/examples/php/preg_match/example01.php
The \t inside of '' has no special meaning.
So you don't have a TAB character in there.
You need "" to get \t to mean TAB
Once you do that, you should then escape the $ with \$ instead of just
$ in order to be blatantly clear, even though $% is not going to parse
as a variable anyway.
Also, you really ought to use http://php.net/htmlentities
on any data
going to the browser, as what we see and what you expect won't match
up otherwise.
echo "String is: '", htmlentities($str), "'<br />\n";
Finally, to be completely pedantic, echoing out raw $_GET data is a
big XSS hole waiting to be exploited. Start reading here:
http://phpsec.org/
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?