On Mon, Apr 30, 2001 at 02:06:50PM +0100, Matthew Ralston wrote:
> Is there a nice easy function that could be used to get a sub string that
> lies in between two other sub strings in one big string.
> 
> For example... get the text that lies in between "<title>" and "</title>"
> (without the quotes) in the code of a web page.
> 
> I'm after a function like:
> 
> string getstring_between_customdelimiters(string source, string
> open_delimiter, sting close_delimiter)

Regular Expressions are you friends
http://www.php.net/manual/en/ref.regex.php

<?php
$string="whawha <Title>blabla blabla </TITLE> yada";
eregi("<title>(.*)</title>",$string,$result);
echo "Before:\"$string\", after \"$result[1]\"";
?>

-- 

Daniel Tryba

-- 
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