PHP Regex on windows machine, need help!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cjohnweb
Forum Newbie
Posts: 1
Joined: Sat Dec 20, 2008 11:40 pm

PHP Regex on windows machine, need help!

Post by cjohnweb »

Hello!
I am writing a script that needs to scan a page and then parse the page and pull out the "to be" post values.


Example of a pulled page:

Code: Select all

<html><head><title>website!</title>
<body>
 
<form method="post" action="page2.php">
 
<input type="hidden" name="name1" value="value1" />
<input type="hidden" name="name2" value="value2" />
<input type="hidden" name="name3" value="value3" />
<input type="hidden" name="name4" value="value4" />
<input type="hidden" name="daksjdfha-adfad_2sdlkjfa8weerDFAedf" value="<center>some text here<br /><a href="http://www.somesite.com/page.php"><img src="someimage.jpg" /></a></center>" />
<input type="submit" name="submit value="Let's Go!" />
 
</form>
</body><html>
 
Here is what I do:

explode the entire page at every "<input"

then, for each piece of the page we go for the eregi function to find

Code: Select all

name="[something]"
then the same for

Code: Select all

value="[something]"

So here is where I am at. I am using this:

Code: Select all

eregi('value="([a-zA-Z0-9_@\-\_\/\.\+^<^>:=\s]){0,255}"',$value,$val);
It validates and everything with other websites. But it will not return my string. For instance, if I were to use my example page above:

Code: Select all

 
<input type="hidden" name="daksjdfha-adfad_2sdlkjfa8weerDFAedf" value="<center>some text here<br /><a href="http://www.somesite.com/page.php"><img src="someimage.jpg" /></a></center>" />
 

I can get the name just fine, but I can not get the value.


So I need to know the Regular Expression Pattern, in place of what I am already using:

Code: Select all

value="([a-zA-Z0-9_@\-\_\/\.\+^<^>:=\s]){0,255}"
The only thing I can think of is maybe there is a problem with regex on a windows machine or something? I haven't the slightest clue on why it will not return for me.

I should add that everything else comes back fine. I get all the info from all the other fields and everything, but this one just wont work. I have been searching for the answer to this for almost a month now and it is killing me!


Any help would be appreciated, Thank You!!
Post Reply