473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Converting PERL regular expression to PHP?

Con
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

Sep 28 '05 #1
2 2087
Con
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

Sep 28 '05 #2
Am Dienstag, den 27.09.2005, 17:17 -0700 schrieb Con:
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) {


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
--------------------------------------------------------------------

Sep 28 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: John Smith | last post by:
Hello, I have a rather odd question. My company is an all java/oracle shop. We do everything is Java... no matter what it is... parsing of text files, messaging, gui you name it. My question...
4
by: pekka niiranen | last post by:
Hi there, I have perl script that uses dynamically constructed regular in this way: ------perl code starts ---- $result ""; $key = AAA\?01; $key = quotemeta $key; $line = " ...
17
by: Michael McGarry | last post by:
Hi, I am just starting to use Python. Does Python have all the regular expression features of Perl? Is Python missing any features available in Perl? Thanks, Michael
75
by: Xah Lee | last post by:
http://python.org/doc/2.4.1/lib/module-re.html http://python.org/doc/2.4.1/lib/node114.html --------- QUOTE The module defines several functions, constants, and an exception. Some of the...
6
by: Danny Lu | last post by:
Hi, can anyone tell me where I can get a good perl book? TIA Dan
9
by: Dieter Vanderelst | last post by:
Dear all, I'm currently comparing Python versus Perl to use in a project that involved a lot of text processing. I'm trying to determine what the most efficient language would be for our...
5
by: Valerie Hough | last post by:
Is there a C# class that will help convert strings that include fractions ( "2 1/2" e.g.) to doubles ? Convert.ToDouble() throws an invalid input format exception. Obviously I can write code to...
3
by: John Nagle | last post by:
Here's a large Perl regular expression, from a Perl address parser in CPAN: use re 'eval'; $Addr_Match{street} = qr/ (?: # special case for addresses like 100 South Street...
8
by: John Pye | last post by:
Hi all I have a file with a bunch of perl regular expressions like so: /(^|)\*(.*?)\*(|$)/$1'''$2'''$3/ # bold /(^|)\_\_(.*?)\_\_(|$)/$1''<b>$2<\/ b>''$3/ # italic bold...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.