Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial 这样写正则为啥呢

这样写正则为啥呢

Jun 23, 2016 pm 01:48 PM
regular

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

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


回复讨论(解决方案)

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

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


晕,我理解排除了,搞混乱了
Statement of this Website
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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to match multiple words or strings using Golang regular expression? How to match multiple words or strings using Golang regular expression? May 31, 2024 am 10:32 AM

How to match multiple words or strings using Golang regular expression?

How to replace a string starting with something with php regular expression How to replace a string starting with something with php regular expression Mar 24, 2023 pm 02:57 PM

How to replace a string starting with something with php regular expression

How to use regular expressions to remove Chinese characters in php How to use regular expressions to remove Chinese characters in php Mar 03, 2023 am 10:12 AM

How to use regular expressions to remove Chinese characters in php

How to use regular matching to remove html tags in php How to use regular matching to remove html tags in php Mar 21, 2023 pm 05:17 PM

How to use regular matching to remove html tags in php

Sharing tips on using PHP regular expressions to implement Chinese replacement function Sharing tips on using PHP regular expressions to implement Chinese replacement function Mar 24, 2024 pm 05:57 PM

Sharing tips on using PHP regular expressions to implement Chinese replacement function

PHP uses regular expressions to verify whether the input data is a number PHP uses regular expressions to verify whether the input data is a number Mar 21, 2023 pm 02:07 PM

PHP uses regular expressions to verify whether the input data is a number

How to verify if a URL is HTTPS protocol using PHP regex How to verify if a URL is HTTPS protocol using PHP regex Jun 24, 2023 am 08:16 AM

How to verify if a URL is HTTPS protocol using PHP regex

How to use regular replacement to fix Chinese in PHP How to use regular replacement to fix Chinese in PHP Mar 21, 2023 am 11:10 AM

How to use regular replacement to fix Chinese in PHP

See all articles