Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional JavaScript for Web Developers 3rd edition
This is the forum to discuss the Wrox book Professional JavaScript for Web Developers, 3rd Edition by Nicholas C Zakas; ISBN: 978-1-1180-2669-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional JavaScript for Web Developers 3rd edition 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 July 22nd, 2012, 03:00 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default chapter 5, regexp question

hi everyone

in 130 page, there are discussion of difference of creating RegExp with literal and constructor. the book says RegExp created by literal shares same instance, so..

Code:
var re = null,
    i;
for (i=0; i < 10; i++){
    re = /cat/g;
    re.test("catastrophe");
}
would return
Code:
true
false ('cause it starts at index 3)
true ('cause it starts over)
false
...
I thought I got it clearly, but when I tested it in IE 8, every call of test() returned true. am I missing something important? please help




Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about regexp Micheas BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 1 December 14th, 2007 02:10 PM
Question on RegExp exec() method jackhsu BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 2 June 7th, 2007 01:19 AM
RegExp crmpicco Javascript How-To 0 July 7th, 2005 05:59 AM
RegExp crmpicco Classic ASP Basics 0 June 6th, 2005 05:54 AM
RegExp Nitin_sharma Javascript 2 November 30th, 2004 07:21 AM





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