Results 1 to 3 of 3

Thread: [RESOLVED] ereg help for lookbehind and lookforward

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Resolved [RESOLVED] ereg help for lookbehind and lookforward

    What is the syntax for lookbehind and lookforward with ereg? I try to match the month part of a date, and it can look like this:

    2005-05-30
    or
    2005/05/30

    and I only want the 05 part. I tried something like this:
    eregi('(?<=[-/])[[:digit:]][[:digit:]](?=[-/])', $date, $res))

    but doesn't look like it liked that way of doing this, but it works perfectly fine in my regex-coach.


    - ØØ -

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: ereg help for lookbehind and lookforward

    Use PCRE
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: ereg help for lookbehind and lookforward

    Why didn't you say so right away...grr...works now..


    if(preg_match('/(?<=[-\/])\n\n(?=[-\/])/i', $date, $res)){



    - ØØ -
    Last edited by NoteMe; Nov 24th, 2005 at 05:05 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width