Abstract
Every modern programming language has built-in functions for working with strings. In Python, strings have methods for searching and replacing: index(), find(), split(), count(), replace(), and so on. But these methods are limited to the simplest of cases. For example, the index() method looks for a single, hard-coded substring, and the search is always case-sensitive. To do case-insensitive searches of a string s, you must call s.lower() or s.upper() and make sure that your search strings are the appropriate case to match. The replace() and split() methods have the same limitations.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Rights and permissions
Copyright information
© 2009 Mark Pilgrim
About this chapter
Cite this chapter
Pilgrim, M. (2009). Regular Expressions. In: Dive Into Python 3. Apress. https://doi.org/10.1007/978-1-4302-2416-7_5
Download citation
DOI: https://doi.org/10.1007/978-1-4302-2416-7_5
Publisher Name: Apress
Print ISBN: 978-1-4302-2415-0
Online ISBN: 978-1-4302-2416-7
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)