Learning to Program - Advanced Topics - Regular Expressions

Regular expressions are groups of characters that describe a larger group of characters.

So that we can try out the examples you will need to import the re module and use it’s methods. For convenience I will assume you have already imported re in most of the examples shown.

(Note that match() only matches at the front of a string, not in the middle, we can use search() for that as we will see later!)

一応こんなのも試してみた。

re.match('[^fl]ool', 'lool')

Repetition


pydoc re関連