简体   繁体   English

忽略正则表达式匹配中的第一个字符

[英]Ignore First Character in Regex Match

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. 是regexr.com上的正则表达式。

Possible workaround would be to match non > characters: 可能的解决方法是匹配非>字符:

[^>]+(?=<\/a>)

regex101 demo regex101演示

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 Debuggex演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM