Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 17th, 2003, 05:57 AM
Registered User
 
Join Date: Aug 2003
Location: LAlitpur, Bagmati, Nepal.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default help in regular expression

Hi there,
I want to detect the "<script>" or "</script>" or "<script language="javascript">" or "<script language="vbscript">" in the user posted values .I have little knowledge on regular expression and I'm confused how to do it with preg_match() function.please provide me a sample code how to match the the "<script>" or "</script>" or "<script language="javascript">" or "<script language="vbscript">" in the user submitted values.
Thanking you in advance
Dibyendra

Dibyendra
Reply With Quote
  #2 (permalink)  
Old September 17th, 2003, 12:25 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

At it's simplest, you can perform a non-greedy search for everything beginning with "<script" and ending with "</script>".

$pattern = '/(<script.*</script>)/iU';

The trailing iU mean "case insensitive, non-greedy".

  http://www.php.net/pcre

I haven't tested this, but it should give you a decent starting point for you to build from.


Take care,

Nik
http://www.bigaction.org/
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular Expression Help Please rstelma ASP.NET 1.0 and 1.1 Professional 0 January 2nd, 2008 07:01 PM
REGULAR EXPRESSION pallone Javascript How-To 0 September 5th, 2006 06:52 AM
regular expression if-then smay Javascript 4 July 5th, 2005 12:10 PM
Regular Expression Help Greg Griffiths Javascript How-To 4 November 12th, 2004 05:33 AM
Regular Expression Help Hadware .NET Web Services 3 November 4th, 2003 10:51 AM



All times are GMT -4. The time now is 05:59 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.