回答編集履歴
1
例示コードを追加
answer
CHANGED
@@ -1,1 +1,12 @@
|
|
1
|
-
ここでの`flags`は [reモジュールで定義されるフラグ](http://docs.python.jp/2/library/re.html#contents-of-module-re) を表しています。正規表現によるパターンマッチ処理で、その挙動を変更するためのものです。
|
1
|
+
ここでの`flags`は [reモジュールで定義されるフラグ](http://docs.python.jp/2/library/re.html#contents-of-module-re) を表しています。正規表現によるパターンマッチ処理で、その挙動を変更するためのものです。
|
2
|
+
|
3
|
+
たとえば `re.I` を指定すると、大文字・小文字を区別せずにマッチするようになります。
|
4
|
+
```lang-python
|
5
|
+
import re
|
6
|
+
|
7
|
+
re.findall('ab', 'abracatabraABRACATABRA')
|
8
|
+
# ['ab', 'ab']
|
9
|
+
|
10
|
+
re.findall('ab', 'abracatabraABRACATABRA', re.I)
|
11
|
+
# ['ab', 'ab', 'AB', 'AB']
|
12
|
+
```
|