Forum Moderators: coopster
my first post! :)
Im trying to do somthing i think is simple but i dont even know where to start
I want to look at a variable (an html file in a a variable) and extract a line that will look like this)
<form method="post" action="mysite.com/upload.php" name="member_stat" [maybe some more bits here]>
the only thing that *never* changes is the 'name="member_stat"' bit
How can i get this entire line into a variable? i have looked at string functions, cant find anything and im not very good at regular expressions but surely it cant be that hard?
thankyou in advance!
Sorry for the bad news, but you're going to have to regex this one, since it's not a simple find, but one that's also supposed to 'begin' at a place that's not inside the find string itself.
$check = preg_match('#(<[^>]*name="member_stat"[^>]*>)#', $matches);
if($check) $caughtstring = $matches[1];
else $caughtstring = 'doesn\'t seem to be here';
Regexes can be difficult to learn at first but are groovy.
Another hint: learn the preg_ expressions and not the ereg ones, preg is faster and more flexible, ereg is 'older.'
happy regexing!