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"
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"
(title=")([^"]*)(".*)
.* 将匹配任何字符
然后替换为
\1This is the new information\3
\2
将保存提取的值
您需要使用具有正则表达式替换功能的语言或工具。此正则表达式应与您尝试执行的操作相匹配:
^title="(.*)"$
正则表达式替换示例:
preg_replace('^title=[\]?"(.*)[\]?"$','new information','title="information here"');
将“此处的信息”替换为“新信息”