Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 7th, 2004, 11:34 AM
rbd rbd is offline
Registered User
 
Join Date: Oct 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default javascript pattern matching...

var sPatternToMatch = /\bsrc="/cachedimages/;
if (sHTMLDetail.match(sPattern) !=null){
...
...
}
gives a syntax error. But if i do something like this

var sPatternToMatch = /\bsrc="cachedimages/; works fine.

I need to do a pattern match for

src="/cachedimages

How can I achieve this?

Please help.

Thank you.
 
Old October 7th, 2004, 12:20 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

you just need to escape the chars " and / like this:
var sPatternToMatch = /\bsrc=\"\/cachedimages/;





Similar Threads
Thread Thread Starter Forum Replies Last Post
Find Matching pattern in Given String sanjivbshinde ASP.NET 2.0 Professional 3 October 10th, 2008 06:32 PM
Regular expression to select non-matching pattern Neuron BOOK: Beginning Regular Expressions 1 June 12th, 2006 10:06 AM
Question on Pattern matching using VBscript Dereksam VBScript 1 September 9th, 2004 04:45 AM
PHP Pattern Matching joanncae BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 May 17th, 2004 04:52 PM
Pattern Matching using PHP spraveens PHP Databases 2 March 23rd, 2004 10:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.