Javascript正则表达式不匹配
基本上,我在为列表创建正则表达式时遇到问题,例如:Javascript正则表达式不匹配,javascript,regex,match,Javascript,Regex,Match,基本上,我在为列表创建正则表达式时遇到问题,例如: 1. Eccentric Shop Teacher 20M+ Good EST 2. Wanwood Crown 18M+ Low
1. Eccentric Shop Teacher 20M+ Good EST
2. Wanwood Crown 18M+ Low WWC
3. Domino Crown 16M+ Great DC
4. Dominus Empyreus 16M+ Great Emp
我正在使用的正则表达式:(\d+。\s)([\w\'\s\d])([\d\w\+])
仅与以下内容匹配:
- 1:“1。”
- 2:“E”
- 3:“c”
- 1:“1。”
- 2:“古怪的商店老师”
- 3:“20米以上”
- 4:“好”
- 5.“东部标准时间”
var regex = /(\d+\.)\s+([a-z]+(?:\s[a-z]+)*)\s+(\d+M\+)\s+([a-z]+)\s+([a-z]+)/i;
说明:
(\d+\.) # first capturing group: one or more digits and a dot
\s+ # spaces
( # open the second capturing group
[a-z]+ # one or more letters (a word)
(?: # open a non capturing group
\s[a-z]+ # a space followed by a word
)* # close the non capturing group, repeat zero or more times
) # close the second capturing group
\s+ # one or more spaces
(\d+M\+) # third capturing group: one or more digits, M, +
\s+
([a-z]+) # fourth capturing group: a word
\s+
([a-z]+) # fifth capturing group: a word
“1.偏心车间教师20M+良好EST 2.万伍德皇冠18M+低WWC 3.多米诺皇冠16M+大DC 4.多米努斯皇帝16M+大皇帝”……缩进此部分!!!谢谢你编辑它,你确定你在
Teacher
和20+
之间有那么多的制表符/空格吗?你能给我解释一下吗?因为我不太擅长正则表达式。