php-general | 2001092
Date: 09/26/01
- Next message: Sami Kyösti: "[PHP] How can I fetch a table from html file using php?"
- Previous message: Lukas: "[PHP] Re: Running Programs....."
- In reply to: _lallous: "[PHP] Re: one pattern, one string, multiple results"
- Next in thread: * R&zE:: "Re: [PHP] one pattern, one string, multiple results"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
use this modifier /ies instead of /ie
"_lallous" <elias_bachaalany <email protected>> wrote in message
news:20010926073304.63730.qmail <email protected>
> try this!
> I don't know how effective is preg_replace w/ huge memory contents....but
> this should work fine!
>
> $mem = "an arc is an archer, arc but what about marc and darcy?";
> $match = "arc";
> $count = 0;
> preg_replace("/\b$match\b/ie", "\$count++;", $mem);
> echo $count;
>
> "Richard Baskett" <rick <email protected>> wrote in message
> news:B7D6CB46.39A9%rick <email protected>
> > I just can not seem to figure this out.
> >
> > If i have a pattern 'arc' and I want to search the string:
> > "an arc is an archer, but what about marc and darcy?"
> >
> > How can I find out how many occurances of arc is within that string? I
> know
> > I can do an explode and then compare it, but when you have huge amounts
of
> > text... is this the best way? Or is there something better? Any help
> would
> > be great I have been struggling with this for awhile, since I really do
> not
> > want to explode, pun intended :)
> >
> > Rick
> >
>
>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Sami Kyösti: "[PHP] How can I fetch a table from html file using php?"
- Previous message: Lukas: "[PHP] Re: Running Programs....."
- In reply to: _lallous: "[PHP] Re: one pattern, one string, multiple results"
- Next in thread: * R&zE:: "Re: [PHP] one pattern, one string, multiple results"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

