Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 3. Regular Expressions > Item 37. Make regular expressions readable

Item 37. Make regular expressions readable

Regular expressions are often messy and confusing. There’s no denying it—regular expressions have a very compact and visually distracting appearance. They are a “little language” unto themselves. However, this little language isn’t made up of words like foreach and while. Instead, it uses atoms like \w, [a-z], and +.

The concept of regular expressions is confusing all by itself. Ordinary programming chores generally translate more-or-less directly into code. You might think “count from 1 to 10,” and write a foreach loop like the following:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint