home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Book HomePHP CookbookSearch this book

13.3. Matching Words

13.3.2. Solution

The key to this is carefully defining what you mean by a word. Once you've created your definition, use the special character types to create your regular expression:

/\S+/         // everything that isn't whitespace
/[A-Z'-]+/i   // all upper and lowercase letters, apostrophes, and hyphens

13.3.4. See Also

Recipe 16.3 for information about setting locales.

Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.