Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #4037

Re: regex help

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: regex help
Date 2011-12-09 07:32 -0500
Organization A noiseless patient Spider
Message-ID <jbsv55$h44$1@dont-email.me> (permalink)
References <jbs0l0$7nj$1@dont-email.me> <4ee1f717$0$29383$a8266bb1@newsreader.readnews.com>

Show all headers | View raw


On 12/9/2011 6:55 AM, Denis McMahon wrote:
> On Thu, 08 Dec 2011 22:51:56 -0500, Jerry Stuckle wrote:
>
>> OK, guys, I'll be the first to admit my regex knowledge is more than
>> limited.   And I've never used ereg().
>>
>> So, I need to convert the following ereg() call in some code I'm
>> modifying to a preg() call.  Can someone please tell me what the ereg()
>> does and the equivalent preg()?
>>
>> if (ereg("(error</b>:)(.+)(<br)", $buffer, $regs))
>
> Hmmm
>
> By comparing the manual for the two functions:
>
> ereg returns false or 0 if no matches depending on the presence of the
> third parameter, or the length of the matched string (which it puts in
> $regs[0])
>

Hi, Denis,

Unfortunately, it's more than that.  preg() uses posix regex syntax, 
ereg() uses something else.  That's my problem; I don't know the 
differences.

If I know what I'm looking for, I can generally fumble around and get a 
regex that works (as long as it's not too complicated).  But this is in 
a generic error handler, and not understanding the ereg() syntax I'm not 
exactly positive what it's looking for.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

regex help Jerry Stuckle <jstucklex@attglobal.net> - 2011-12-08 22:51 -0500
  Re: regex help Denis McMahon <denismfmcmahon@gmail.com> - 2011-12-09 11:55 +0000
    Re: regex help Jerry Stuckle <jstucklex@attglobal.net> - 2011-12-09 07:32 -0500
      Re: regex help Jerry Stuckle <jstucklex@attglobal.net> - 2011-12-09 07:51 -0500
  Re: regex help Kim André Akerø <kimandre@nospambetadome.com> - 2011-12-09 14:16 +0100
    Re: regex help Jerry Stuckle <jstucklex@attglobal.net> - 2011-12-09 21:51 -0500
  Re: regex help Curtis Dyer <dyer85@gmail.com> - 2011-12-10 04:25 +0000
    Re: regex help Denis McMahon <denismfmcmahon@gmail.com> - 2011-12-10 10:01 +0000

csiph-web