Jump to content

Easy regex question,


jamesmiller

Recommended Posts

hey guys. sorry if this is a simple question and easy to do but i need a regex to pick out

Author: anything can be here </h3>

 

from

 

 <h3> <span class="author"> Author: </span> <span> <a href="/catalog/list_author_titles?author=John+search=search">John </a> </span>

 

Thank you for any help,

Link to comment
https://forums.phpfreaks.com/topic/247267-easy-regex-question/
Share on other sites

<?php
$string = "<h3> <span class='author'> Author: </span> <span> <a href='/catalog/list_author_titles?author=John+search=search'>John </a> </span></h3>";
$pattern = "~Author: .*~i";
preg_match($pattern,$string,$matches);
foreach($matches as $match){
	print $match . "<br />";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/247267-easy-regex-question/#findComment-1269887
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.