qmaruf qmaruf - 1 year ago 51
HTML Question

how to get all text of html file inside two specific keywords

I have a html file and two keywords . now i want to get all text which resides inside those two key words. should i use regex ?? i want to take those two keywords as input .
It would be helpful if you give an example.

Dor Dor
Answer Source

Yes, use Regex: keyword1(.*?)keyword2. PHP example:

preg_match_all('/'.$kwdOne.'(.*?)'.$kwdTwo.'/s', $str, $matches);

Read: preg_match_all() and Pattern Modifiers.