【发布时间】:2014-01-12 13:51:41
【问题描述】:
我想编写一个 Javascript 正则表达式来查找任何给定单词的 KEY(页码) 例如在下面的段落中
Key for Chota = 1
Key for Seven = 1 & 2
Key for wonder =3
(就像查找所有页面上都有单词一样)
||1||
Jam Jam jambura jadu tu sikh le aisa
Chota Bheem and Kisna Seven
||2||
One Two Three Bla Bla Bla
Nine Eight Seven Laa Laa Laa
||3||
twinkle twinkle little star
how I wonder what you are
我写了下面的表达式,但它不能正常工作
/(?:\|\|)(\d+)(?=\|\|)(?=(.|\n)*wonder)/img;
【问题讨论】:
-
你不需要正则表达式。请给我们您的 html 示例,其中显示匹配时要返回的键。
-
@DerekHenderson 什么 HTML?
标签: javascript regex