Hello!

You should write something like this:
    if (preg_match("/<H2>(.*)<\/H2>/Ui", $str, $matches))
        echo $matches[1];
U modufier - ungreedy match
i modifier - case insentensive

>Where can I start to learn reg-exp?
If you want to get more abot regexp - read php manual at least.Or try to
find some good perl book (there are a lot of free in the net). Or type
"regexp tutorial" in google.

> Should I use the ereg- oder preg-functions?
I prefer preg style, because of more flexible and powerful syntax.

Best regards,
Andrew Kirilenko.

> -----Original Message-----
> From: Martin Thoma [mailto:[EMAIL PROTECTED]]
> Sent: Friday, November 16, 2001 9:31 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Regular expressions?
>
>
> Hello!
>
> I need to search for strings between html-tags. For example, I need to
> know if the String "Searchstring" is between "<H2>" and "</H2>"
> (case-insensitive).
>
> How is it done?
>
> I think I need regular expressions, but I have no idea about it. I'm not
> getting to clever out of the php-documentaion. Where can I start to
> learn reg-exp? Should I use the ereg- oder preg-functions? Help!
>
> Martin
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to