Chapter 3
String Searching
IN THIS CHAPTER
Searching text sequentially
Searching by using regular expressions
Searching strings phonetically
Searching for data is one of the most common functions in writing a computer program. Most searching algorithms focus on searching a list of values, such as numbers or names. However, there’s another specialized type of searching, which involves searching text.
Searching text poses unique problems. Although you can treat text as one long list of characters, you aren’t necessarily searching for a discrete value, like the number 21 or the last name Smith. Instead, you may need to search a long list of text for a specific word or phrase, such as ant or cat food. Not only do you need to find a specific word or phrase, but you also may need to find that same word or phrase multiple times. Because of these differences, computer scientists have created a variety of searching algorithms specifically tailored for searching text.
Get Beginning Programming All-in-One For Dummies, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.