-1

I have a html tag like this

<img src="ngakak.gif" title="ngakak" />

and I want to split the tag with 2 pattern, they are title= and /> . then will result the array like this:

Array
 (
     [0] => <img src="ngakak.gif"
     [1] => "ngakak"
 )

I want the splitting of 2 patterns worked direct in one regex. how do this with preg_split ?

RieqyNS13
  • 465
  • 1
  • 5
  • 13

1 Answers1

0

Are you looking to extract the title element from all img tags?

preg_match_all('/< *[img][^>]*title *= *["']{0,1}([^"'>]*)/',$content,$matches);
Brent
  • 304
  • 1
  • 7