Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

RE: [PHP-DB] preg_math vs preg_match_all
For those perl fans out there, preg_match_all adds the g (global) flag =
to the expression. So this:

preg_match('/foo/', $str, $match);

would be like

$str =3D~ /foo/;

preg_match_all('/foo/', $str, $match);

like

$str =3D~ /foo/g;

- Russ

p.s. - anyone coming from Perl to PHP can get a little hung up on the =
preg_* functions...

-----Mensaje original-----
De: Gerard Samuel [mailto:php-db@trini0.org]
Enviado el: Tuesday, November 23, 2004 2:37 PM
Para: Yemi Obembe
CC: php-db@lists.php.net
Asunto: Re: [PHP-DB] preg_math vs preg_match_all


Yemi Obembe wrote:

>Just want to know the difference between preg_match and preg_match_all.
>
preg_match stops after the first match.
preg_match_all gets *all* the matches.

E.g.  If you have a string -> $str =3D "foofoo";
preg_match('/foo/', $str, $match); -> $match will have an array with one =

"foo".
preg_match_all('/foo/', $str, $match); -> $match will have an array with =

two "foo".

Thats basically it.

--=20
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Report this thread to moderator Post Follow-up to this message
Old Post
Russell Johnson
11-24-04 01:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP DB archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:31 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.