找回密码
 注册
查看: 870|回复: 3

正则表达式匹配问题

[复制链接]
发表于 2005-12-29 16:44:50 | 显示全部楼层 |阅读模式
想匹配一些字符串出来,使用正则表达式应该如何编写?
1. 匹配双引号内的内容(最小匹配,且不认为\"为双引号),例如
"this is a test" -> this is a test
"\"string\"" -> \"string\"

2. 匹配大括号里的内容(最小匹配,且不认为双引号内的{}为大括号),例如
{this is a test} -> this is a test
{this is a "test"} -> this is a "test"
{this is a "{test}"} -> this is a "{test}"
发表于 2006-1-2 18:11:44 | 显示全部楼层
1 .*\"[^(\\\")]*\".*
你要的是这个意思不?
回复

使用道具 举报

 楼主| 发表于 2006-1-3 12:34:40 | 显示全部楼层
不是的,这样得不出来
回复

使用道具 举报

发表于 2006-1-3 17:55:07 | 显示全部楼层
你要把字符串给提出来呀?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2025-2-7 14:11 , Processed in 0.019309 second(s), 15 queries .

© 2001-2025 Discuz! Team. Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表