Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 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 Display Modes
  #1 (permalink)  
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
Reply With Quote
Reply


Thread Tools
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
Question about regexp Micheas BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 1 December 14th, 2007 01: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 06:21 AM



All times are GMT -4. The time now is 01:53 AM.


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