Re: Little regex tweak help please
| From: | Nick Wilson | Date: | Sun, 10 Oct 2004 11:21:20 +0000 |
| Subject: | Re: Little regex tweak help please | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-199103@lists.php.net to get a copy of this message | ||
* and then Marek Kilimajer declared....
> >The html *always* looks like this:
> >
> ><form method="post"
> >action="http://example.com/someForm.cgi"
> >name="user_notification" [some other stuff here]>
> >
> >This is my attempt to find the correct one so far:
> >
> >'/action\s*=\s*"([^"]+)".*name\s*=\s*"([^"]+)"/is'
> >
> >im having trouble putting the 'user_notification' bit in...
> >
> >This does not work:
> >
>
> >>'/action\s*=\s*"([^"]+)".*name\s*=user_notification\s*"([^"]+)"/is'
>
> You missed the quotes around user_notification, and also possible white
> chars
Right! - this looks better but still not a winner - small testing
script:
<?php
$formString=<<<EOF
<html>
<head>
<arse>
<form method="post" action="http://actionurl.php" name="TheWrongForm" />
<form method="post" action="http://theActionUrl.php"
name="user_notification" >
EOF;
preg_match('/action\s*=\s*"([^"]+)".*name\s*=\s*"user_notification"/is',
$result, $actionval);
print("<pre>");
print("\$resulti\n\n");
print_r($result);
print("\$actionval\n\n");
print_r($actionval);
print("</pre>");
?>
It produces nothing LoL!
thanks again Marek..
--
Nick W