I am trying to write a pattern for extracting the path for files found in img tags in HTML.
String string = \"
This one only grabs the src only if it's inside of an tag and not when it is written anywhere else as plain text. It also checks if you've added other attributes before or after the src attribute.
Also, it determines whether you're using single (') or double (") quotes.
\
So for PHP you would do:
preg_match("/\/", $string, $matches);
echo "$matches[1]";
for JavaScript you would do:
var match = text.match(/\/)
alert(match[1]);
Hopefully that helps.