Re: Regular expressions?
| From: | Papp Gyozo | Date: | Fri, 16 Nov 2001 16:53:09 +0000 |
| Subject: | Re: Regular expressions? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-74903@lists.php.net to get a copy of this message | ||
<?php
$quoted = preg_quote($searchstring, '!');
preg_match_all('!<(\w+)(?>[^>]*)>.*'.$quoted.'(?>[^<]*)</$1>!Ui',
$source, $matches);
?>
good point to start:
http://www.php.net/manual/en/ref.pcre.php
----- Original Message -----
From: "Martin Thoma" <martin@radiok2r.de>
To: <php-general@lists.php.net>
Sent: Friday, November 16, 2001 8:30 AM
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: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>