[Regular Expression] Beginner's Tutorial Using Python re Module

Tadashi Shigeoka ·  Sat, August 27, 2011

I’m thinking about writing a Python program that extracts parts that match specific words.

Python

This requires knowledge of regular expressions, so I read the beginner’s tutorial on regular expressions using the re module published by the Python Users Group Japan (PyJUG).

Here’s the content:

・ 1. Introduction

・ 2. Simple Patterns   Character Matching / Repetition

・ 3. Using Regular Expressions   Compiling Regular Expressions / Backslash Plague / Performing Matches / Module-Level Functions / Compilation Flags

・ 4. More Pattern Power   Other Metacharacters / Grouping / Non-capturing Groups and Named Groups / Others

・ 5. Modifying Strings   String Splitting / Search and Replace

・ 6. Common Problems   Learning About the string Module / match() vs search() / Greedy vs Non-Greedy / Using re.VERBOSE…

・ 7. Feedback

Since it’s translated, some Japanese expressions are a bit awkward, but it was easy to understand and educational.

That’s all from the Gemba.