i have following php regex code.. i want to extract the stock symbol in some html output.
The stock symbol i want to extract is /q?s=XXXX -- XXXX (the stock symbol) could be 1 to 5 characters long.
if(preg_match_all('~(?<=q\?s=)[-A-Z.]{1,5}~', $html, $out))
{
$out[0] = array_unique($out[0]);
} else {
echo "FAIL";
}
HTML code below (case 1 and case that i applied this to)
case #1 (does *not* work)
<a href="/q?s=BLCM" symbol="BLCM">Bellicum Pharmaceuticals, Inc.</a>
case #2 (does work correctly)
<a href="/q?s=NYLD">NYLD</a>
Looking for suggestions on how i can update my php regex code to make it work for both case 1 and case 2. Thanks.