Get text between elements with regex
Posted on 2006-04-18
OK, this ought to be a piece of cake, but for whatever reason, it's become a big deal. I am simply trying to return text between two elements.
For example, suppose I have a form, and it contains
whatever I want here
maybe there are line breaks
Now, using PHP, I ought to be able to grab what is in the <text> tags and do other stuff with it.
I've tried madness like, preg_match_all("/(<text>blah<\/text>)/",$form_input,$matches) and then looping through it, to no avail. Note that it won't even match on '<t'. I'm [obviously?] new to PHP, and I have read the docs for this, but regardless of my variations, nothing has worked.
thanks for the help