Multiline Mode Regex
Uses multiline flag to match start/end of each line.
パターン
/^\d+\.\s.+$/gm
→ ビジュアライザーで開くテスト例
1. First item
2. Second item
Not a list item
3. Third item
コード例
javascript
const regex = /^\d+\.\s.+$/gm; const result = str.match(regex);
python
import re pattern = re.compile(r'^\d+\.\s.+$', re.MULTILINE) result = pattern.findall(text)
go
import "regexp" re := regexp.MustCompile(`(?m)^\d+\.\s.+$`) result := re.FindAllString(text, -1)
multilineflagstutorial