Re: Meta Tags and Regular Expressions

From: Date: Mon, 13 Aug 2001 07:38:34 +0000
Subject: Re: Meta Tags and Regular Expressions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-62378@lists.php.net to get a copy of this message
On Fri, Aug 10, 2001 at 01:29:26PM -0400, Kyle Mathews wrote: > Hello: > > I'm looking for a good way to pull information from a static HTML file for > dumping into a database. > I need to pull the information from a META tag, and from within two comments > in the HTML file. > I know this can be done with regular expressions, but I'm not really sure > where to start or how to do it. > > <META name="CATEGORY" CONTENT="Test Content"> > > I need to pull the CONTENT information from this META tag. > > <!-- STORY START --> > > Story contents > > <!-- STORY END --> > > Then pull the information from between these two comments. > > Any help, and/or example code would help a lot. This is for an exact match of your example above: preg_match ("/<META[^>]+CONTENT=\"([^\"]+)\"/", $string, $matches) If you don't know if it's in upper and/or lower case: preg_match ("/<meta[^>]+content=\"([^\"]+)\"/i", $string, $matches) -- * R&zE: -- »»»»»»»»»»»»»»»»»»»»»»»» -- Renze Munnik -- DataLink BV -- -- E: renze@datalink.nl -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- H: +31 23 5516190 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- -- http://www.datalink.nl -- ««««««««««««««««««««««««

« previous php.general (#62378) next »