iT邦幫忙

2018 iT 邦幫忙鐵人賽
DAY 11
0
pattern description
. any character except a newline
^ start of the string
$ end of the string
* match 0 or more repetitions of the preceding RE. greedy.
+ match 1 or more repetitions of the preceding RE. greedy.
? match 0 or 1 repetitions of the preceding RE. greedy.
*? non-greedy version of *
+? non-greedy version of +
?? non-greedy version of ?
{m} exactly m copies of the previous RE
{m,n} match from m to n repetitions of the precedingRE
{m,n}? non-greedy version of {m ,n}
\ escapes special characters
[] indicate a set of characters
| match either A or B, where A and B can be arbitrary REs

greedy: they match as much text as possible
non-greedy: minimal fashion; as few characters as possible will be matched

參考


上一篇
Day23-re-概觀
下一篇
Day25-re-簡單範例
系列文
if len(learning.python) == 30:31
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言