正则表达式匹配双引号,但不匹配双引号 [英] Regex match double quote, but not pair of double quotes

查看:86
本文介绍了正则表达式匹配双引号,但不匹配双引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个正则表达式来匹配(并最终捕获、替换和转义)",而不是 ".*",并且可以'好像没搞清楚.

I'm trying to create a regular expression to match (and ultimately capture, replace, and escape) ", but not ".*", and can't seem to figure it out.

如何匹配单引号,而不是它们的集合?

How to match the singular quote, and not the set of them?

推荐答案

我认为你需要的表达方式是这样的:

I think the expression you need is something like this:

^([^"]*?)(")([^"]*?)$

请在此处查看示例:http://www.regexr.com/39qf4

这篇关于正则表达式匹配双引号,但不匹配双引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆