I'm pretty bad with regex and need some help with the scenario below:
How do I extract all the strings between #
and /
in the string below using PHP:
$text = '<a href=\"http://example.com/what-is-row#row\"><a href=\"http://example.com/what-is-code#code\">';
Here's what I tried but it pretty much returns only one match along with the #
and /
but I don't want the results with the characters
$pattern = "/#(.*?)\//i";
preg_match_all($pattern, $input, $matches);
Result:
array(2) { [0]=> array(1) { [0]=> string(23) "#row\"> array(1) { [0]=> string(21) "row\">
Thanks in advance