Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Expert PHP and MySQL
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Expert PHP and MySQL
This is the forum to discuss the Wrox book Expert PHP and MySQL by Andrew Curioso, Ronald Bradford, Patrick Galbraith; ISBN: 9780470563120
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Expert PHP and MySQL 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 February 28th, 2011, 04:44 AM
Registered User
 
Join Date: Feb 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 1 - Regular Expressions - Capturing Data

Not sure how to suggest an errata .... or indeed to be proved wrong :)

Page 53, Capturing data, example:-

/('|")[^\1]*?\1/

The notes indicate that the ? is important because you need to make the match lazy so that it matches the first instance and not a "giant quoted string" made up of multiple quoted strings - this seems to me to be wrong.

If you look at the example without the question mark...

/('|")[^\1]*\1/

... you will see that this will NEVER match multiple quoted strings on the same line because the section between the quotes has to match the pattern [^\1]* (i.e any character EXCEPT a quote) - The "giant quoted string" option is therefore not possible because it would have to contain a quote, which clearly it cannot.

Does that make sense?

I am not big on complaining about such things, but since pattern matching is so often misunderstood I felt that this early reference to it in the book needed to be correct.

Here's hoping I got this wrong :)

Moopi
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
Do I need regular expressions..? ypomonh XSLT 2 May 20th, 2007 05:09 PM
Help with Regular Expressions WestRowOps Other Programming Languages 1 May 18th, 2007 05:34 AM
Regular Expressions mega Beginning PHP 1 February 5th, 2007 04:31 PM
regular expressions help kyootepuffy Classic ASP Databases 2 September 10th, 2003 01:37 PM
Regular Expressions Dave Doknjas C# 1 August 9th, 2003 12:05 AM



All times are GMT -4. The time now is 05:10 AM.


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