Greetings,
I am stumbling here trying to put together a regular expressions, either POSIX or PCRE style, to extract out the value of an action attribute from a form tag (parsing out an HTML document).
Examples:
<fom action="http://www.domain.com" method="post">
<form action='http://www.domain.com' method='post'>
The attribute v alue could be surrounded by a single quote or double quote. Additionally, there could be spaces (*\s) between the attribute name, the equal sign, and the value.. such as
<form action = "http://www.domain.com" method="post">
Additionally, I am trying to capture all occurances of the attribute value within the specified string, so if a string has multiple HTML forms, then I would get an array containing all of the action values.
I figure preg_match_all would be the function to use and I am trying
preg_match_all('action=?(?(1) (.*?)\1 | ([\s>]+))',$document,$actions);
but I am getting an error of
Unknown modifier '('
This is my first foray into regular expressions and there must be something I am not grasping... any help is appreciated.