开发者

quick problem with regular expressions

开发者 https://www.devze.com 2023-03-27 19:38 出处:网络
I\'m having trouble stripping this piece of HTML: title=\"External Link\" alt=\"External Link\"/></h5>

I'm having trouble stripping this piece of HTML:

title="External Link" alt="External Link"/></h5>
                </a>


                This text is needed without the spaces..

            </div>

Here is the general method I attempted:

$array = array();
preg_match( '/<\/h5>(.*?)               
            /si', $data, $array ) ;

I just can't seem to crack it.

Any help would be appreciated,

Thanks!

开发者_运维问答

P.s The text may also contain html tags itself, such as <em> or <strong>


This should work.

preg_match('#</h5>\s*</a>\s*(\w.+)\s*</div>#Uis', $data, $array);
0

精彩评论

暂无评论...
验证码 换一张
取 消