PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Fri Sep 21, 2018 5:55 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Mar 01, 2011 7:14 pm 
Offline
Forum Newbie

Joined: Fri Jul 18, 2008 8:27 pm
Posts: 6
Hi I suck with regex - please help.

Need to parse a HTML document for script tags. Within these script tags, I need to match Javascript legal forms of the following:
document.form.action = "/some/URL";
but where "some/URL" does NOT START with "/FOO-"

So, I should match:
document.form.action="someother/URL";
AND
document.form.action = "someother/URL/1/2/3jhkj" ;
AND
document.form.action=
"someother/URL";

I also need a reference to the URL "/some/URL" because I need to encrypt it...

I have tried:
'#(document\.form\.action)[\s]*=[\s]*["\']([^(/FOO-)][.]*)["\']#'


Top
 Profile  
 
PostPosted: Wed Mar 02, 2011 11:29 am 
Offline
DevNet Master
User avatar

Joined: Mon Feb 24, 2003 11:12 am
Posts: 2572
Location: The Republic of Texas
This should work:
Syntax: [ Download ] [ Hide ]
'#document\.form\.action[\s]*=[\s]*["\'](?!/FOO-)([^"\']+)["\']#'

_________________
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: ckblackmoncler and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group