Page 1 of 1

Capture text between tags

Posted: Wed Sep 21, 2005 5:16 am
by zippee
Hi, is there any php function can read text between tags or quotes.

For example, I have <h1>This is heading 1</h1> and "This is text in Quote", how can I use php to read the text between <h1></h1> tags or the text between quotes? I know I can use substr but is there any function that can directly read the text?

Posted: Wed Sep 21, 2005 5:23 am
by shiznatix
you are going to have to use a regular expression probably, you could use somtin like turning it all into a array then checking with strpos but that would be real slow and painful to code. just use a regular expression, sorry im not good at them though so i cant write one for you

Posted: Wed Sep 21, 2005 8:07 am
by zippee
Which regular expression you mean?

Posted: Wed Sep 21, 2005 8:10 am
by feyd
read through the regex board here... viewforum.php?f=38

everything you need has been talked about in there at some point or another.........