A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: Regulat Expression trouble

  1. #1
    the usual
    Join Date
    Jul 2000
    Posts
    1,482

    Regular Expression trouble

    I've been going crazy for hours tyring to get this working, so I'm turning to the pros

    I'm trying to split the data up in to arrays, I want something similar to:

    PHP Code:
    $array[0]='<!-- TemplateBeginRepeat name="doctypes" -->text text<!-- commentStart -->something<!-- commentEnd --><!-- TemplateEndRepeat -->';
    $array[1]=name='"doctypes"'
    $array[2]='text text<!-- commentStart -->something<!-- commentEnd -->' 
    I've managed to kludge the begin tag and the end tag, but i can't get the whole pattern to match. can anyone help

    PHP Code:
    $string '<!-- TemplateBeginRepeat name="doctypes" -->text text<!-- commentStart -->something<!-- commentEnd --><!-- TemplateEndRepeat -->';

    $pattern    '/<\!..\s((TemplateBeginRepeat)\s(.*?))*..>/i';// begin tag
    //$pattern    = '/<\!..\sTemplateEndRepeat\s..>/i'; // end tag
    $string    preg_replace_callback $pattern"TemplateBeginIf"$string );
    print 
    $string;

    function 
    TemplateBeginIf $m )
    {
        return 
    '[-------]';

    thanks millions in advance.
    Last edited by Trickman; 06-16-2005 at 07:43 PM.

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

HTML5 Development Center