Yes! It works!!! This is also an good beginner-HTML.

If you have improvements then i like it from you to post them in an reply or
email me.

Regards,

Bas
"Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> * Thus wrote Bas ([EMAIL PROTECTED]):
> > This error is not so stupid as a deleted closing ".
> >
> > Okay, for all of you who missed my code here is it again:
>
> >
> > read-tags.php
> > ---
> > <?php
> > // Tag Parser v1.1
> > // v1.0 First release(not working)
> > // v1.1 Edited:
> > //     Uses Regular Expressions
> > function parseTags($file) {
> >   /* readfile... here */
> >   $filedata = file_get_contents($file);
> >   $tag_match = "!<bttag=(\w*)>\s*([^<]*)\s*</bttag>!is";
>
> Mabey I should have explained the regex.  The tagname (the value in
> matches[1][$] can only be a word character (\w*) and the value
> ($matches[2[$i] inside the tag will find all characters upto the
> </bttag> except for the < character.
>
> Also do note, the '\s*' before and after the (.*?), this will force
> the value returned without leading or trailing white space.
> Depending on your situation this might not be desireable.
>
> [...]
> >
> > <bttag=text>
> > Welcome to my BTML page!!! This is an experimentally version of HTML!!!
> > <br>Bye!!!
> > </bttag>
> [..]
> >
> > Run btml.php?name=test.btm and you will get this error plus good output:
> >
> > Notice: Undefined index: text in C:\pub\include\btml.php on line 15
>
> According to my description above, the code will ignore anything
> that has a < character within the tags. so to allow this you'll need to
> change the regex to something like:
>
> $tag_match = "!<bttag=(\w*)>\s*(.*?)\s*</bttag>!is";
>
> this will force it to match *anything* between the tags, except for
> leading and trailing white space.
>
>
> Curt
> -- 
> "My PHP key is worn out"
>
>   PHP List stats since 1997:
>   http://zirzow.dyndns.org/html/mlists/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to