admin管理员组文章数量:1202598
I need to ignore the >
in my regular expression in the beginning.
My regular expression:
/(>(.+)(?=<\/a>))/igm
Matches the following:
How do I tell it to ignore the >
in the beginning?
Here is the regular expression on regexr.
I need to ignore the >
in my regular expression in the beginning.
My regular expression:
/(>(.+)(?=<\/a>))/igm
Matches the following:
How do I tell it to ignore the >
in the beginning?
Here is the regular expression on regexr.com.
Share Improve this question edited Aug 16, 2019 at 18:32 Asad Shakeel 2,2851 gold badge25 silver badges30 bronze badges asked Jun 30, 2014 at 20:43 MatthewMatthew 2,2468 gold badges32 silver badges54 bronze badges 3- positive lookbehind, though it doesnt work in regexr.com for some reason. – Ed Morales Commented Jun 30, 2014 at 20:46
- 1 @EdwardM.B.: the reason is that the lookbehind feature isn't available in Javascript. – Casimir et Hippolyte Commented Jun 30, 2014 at 20:48
- stackoverflow.com/questions/590747/… – epascarello Commented Jun 30, 2014 at 20:49
2 Answers
Reset to default 12Possible workaround would be to match non >
characters:
[^>]+(?=<\/a>)
regex101 demo
Or you take the substring of each of your results in the code itself.
You can use:
.*?>(\w+)<
Here you can check a working example:
Debuggex Demo
本文标签: javascriptIgnore First Character in Regex MatchStack Overflow
版权声明:本文标题:javascript - Ignore First Character in Regex Match - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738618158a2103031.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论