Home  >  Article  >  Backend Development  >  这样写正则为啥呢

这样写正则为啥呢

WBOY
WBOYOriginal
2016-06-23 13:48:47862browse

要匹配很多类似$trade[subject]
的串,
别人 说应该这样写:href="[^"]*"

但我是我理解这样写是对的href=[^"]*"
我的理解是:第一个必须是以"开头,所以用了[^"]这个正则,如果在其前再加上"那不是重复了吗?不知我的理解哪里不对呢


回复讨论(解决方案)

[^"] 表示双引号以外的字符,即不匹配双引号

[^"] 表示双引号以外的字符,即不匹配双引号


晕,我理解排除了,搞混乱了
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn