Re: preg_match
| From: | Jason Wong | Date: | Wed, 28 Aug 2002 07:53:31 +0000 |
| Subject: | Re: preg_match | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-114334@lists.php.net to get a copy of this message | ||
On Wednesday 28 August 2002 15:39, richard.mail@softhome.net wrote:
> hi all,
>
> i'm trying to create an script that cut's the text when a "." ( dot ) is
> found in one of the last words..
>
> i'm trying it with preg_match but it seems not to work.
>
> this is what i'm trying :
>
> if($i==15) {
> if(preg_match("/./",$text2[15])) {
> $text3 .= "($i $text2[15] )";
> break;
> }
> }
>
> could some one tell me what i'm doing wrong?
The period (.) has a special meaning within regexes, it matches any character.
Read manual for full details.
You need to escape special characters using a backslash ie:
"/\./"
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
"We Americans, we're a simple people... but piss us off, and we'll bomb
your cities."
-- Robin Williams, _Good Morning Vietnam_
*/