Connecting Tech Pros Worldwide Help | Site Map

Converting PERL regular expression to PHP?

  #1  
Old September 28th, 2005, 01:25 AM
Con
Guest
 
Posts: n/a
Hi, I'm in the process of converting some PERL to PHP. Thus, is it
possible to leave the following line as is:

if ($id =~ /vvvvv/g) {

...

}

If not, can someone provide PHP equivalent? BTW, I have checked the
syntax using 'php -l' because I'm not an expert of PERL but I'm using
various references to do the conversion. However, I was able to locate
this particular construct.

Thanks in advance,

-Conrad

  #2  
Old September 28th, 2005, 01:35 AM
Con
Guest
 
Posts: n/a

re: Converting PERL regular expression to PHP?


Hi, the last couple of sentences should read:

If not, can someone provide PHP equivalent? BTW, I have checked the
syntax using 'php -l'. Also, I'm not an expert of PERL but I'm using
various references to do the conversion. However, I wasn't able to
locate
this particular construct.

Thanks again,

-Conrad

  #3  
Old September 28th, 2005, 03:45 AM
Sven Lauritzen
Guest
 
Posts: n/a

re: Converting PERL regular expression to PHP?


Am Dienstag, den 27.09.2005, 17:17 -0700 schrieb Con:[color=blue]
> Hi, I'm in the process of converting some PERL to PHP. Thus, is it
> possible to leave the following line as is:
>
> if ($id =~ /vvvvv/g) {[/color]

The php equivalent is

if(preg_match('/vvvvv/', $id)) {

I'm quite sure that you won't need the "g".

See
http://www.php.net/manual/en/function.preg-match.php

Best regards

Sven
--
Sven Lauritzen
--------------------------------------------------------------------
mailto: the minus pulse at gmx dot net

pub 1024D/95C9A892 sub 1024g/D30E490F ABCDEFGHIJKLM
Fp 2FA9 FC9B 078C 5BC7 87DC 0B0D 2329 94F6 95C9 A892 NOPQRSTUVWXYZ
--------------------------------------------------------------------

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing Shell speedster answers 1 July 19th, 2005 06:18 AM
python-dev Summary for 2003-08-01 through 2003-08-15 Brett C. answers 5 July 18th, 2005 02:52 AM