Appendix E. Regular expressions

A regular expression (often abbreviated RegEx) is a search pattern for text. It defines a logical sequence of characters that the computer should look for in a string.

Here’s a simple example. You’ve likely used the Find feature in your web browser at some point. In most web browsers, you can access this feature by pressing Ctrl-F in Windows or Command-F in macOS. The browser reveals a dialog box in which we type a sequence of characters. Then the browser searches for those characters on the web page. Figure E.1 shows an example of the browser searching for and finding romance in the page’s content.

Figure ...

Get Pandas in Action 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.