0

I'm trying to write a regular expression that will allow me to extract the data in between the quotation marks, and then allow me to replace it with new information.

title="Information here"

4

2 回答 2

0
(title=")([^"]*)(".*)

.* 将匹配任何字符

然后替换为

\1This is the new information\3

\2 

将保存提取的值

于 2012-06-22T16:34:47.430 回答
0

您需要使用具有正则表达式替换功能的语言或工具。此正则表达式应与您尝试执行的操作相匹配:

^title="(.*)"$

正则表达式替换示例:

preg_replace('^title=[\]?"(.*)[\]?"$','new information','title="information here"');

将“此处的信息”替换为“新信息”

于 2012-06-22T18:12:25.723 回答