teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

re.MULTILINE は不要なので削除

2019/11/30 12:17

投稿

shiracamus
shiracamus

スコア5406

answer CHANGED
@@ -7,7 +7,7 @@
7
7
  xyz'''
8
8
  test_str2 = "Content-Transfer-Encoding: base64 xyz"
9
9
 
10
- test_re = re.compile(r'base64.*', flags=(re.MULTILINE | re.DOTALL))
10
+ test_re = re.compile(r'base64.*', flags=re.DOTALL)
11
11
 
12
12
  #get base64
13
13
  print(test_re.search(test_str))

1

説明追加

2019/11/30 12:17

投稿

shiracamus
shiracamus

スコア5406

answer CHANGED
@@ -1,3 +1,6 @@
1
+ 公式ドキュメントより
2
+ https://docs.python.org/ja/3.6/howto/regex.html#compilation-flags
3
+
1
4
  ```python
2
5
  import re
3
6
  test_str = '''Content-Transfer-Encoding: base64