Xml 删除不包含';不包含星号字符
在我庞大的xml文件中,有一些注释的代码行 我只想用正则表达式删除它们,而不必触及包含“*”的文档注释 我尝试查找Xml 删除不包含';不包含星号字符,xml,replace,comments,editor,geany,Xml,Replace,Comments,Editor,Geany,在我庞大的xml文件中,有一些注释的代码行 我只想用正则表达式删除它们,而不必触及包含“*”的文档注释 我尝试查找(?s)并替换为null,但它删除了所有xml注释 下面是我的示例xml文件: <?xml version="1.0"?> <!-- /** * Company_Module extension * * NOTICE OF LICENSE * * This source file is subject to the Open Software Licens
(?s)
并替换为null,但它删除了所有xml注释
下面是我的示例xml文件:
<?xml version="1.0"?>
<!--
/**
* Company_Module extension
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* @category Perception
* @package Company_Module
* @copyright Copyright (c) 2008 Perception LLC
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
/**
* @category Perception
* @package Company_Module
* @author Boris (Moshe) Gurevich <moshe@Perception.com>
*/
-->
<config>
<modules>
<Company_Module>
<version>0.2.6</version>
</Company_Module>
</modules>
<global>
<models>
<pstorelocator>
<class>Company_Module_Model</class>
<resourceModel>pstorelocator_mysql4</resourceModel>
</pstorelocator>
<pstorelocator_mysql4>
<class>Company_Module_Model_Mysql4</class>
<entities>
<location>
<table>pstorelocator_location</table>
</location>
</entities>
</pstorelocator_mysql4>
</models>
<resources>
<pstorelocator_setup>
<setup>
<module>Company_Module</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</pstorelocator_setup>
<pstorelocator_write>
<connection>
<use>core_write</use>
</connection>
</pstorelocator_write>
<pstorelocator_read>
<connection>
<use>core_read</use>
</connection>
</pstorelocator_read>
</resources>
<helpers>
<pstorelocator><class>Company_Module_Helper</class></pstorelocator>
</helpers>
<blocks>
<pstorelocator><class>Company_Module_Block</class></pstorelocator>
</blocks>
<pstorelocator>
<private_fields></private_fields>
</pstorelocator>
</global>
<frontend>
<routers>
<pstorelocator>
<use>standard</use>
<args>
<module>Company_Module</module>
<frontName>pstorelocator</frontName>
</args>
</pstorelocator>
</routers>
<translate>
<modules>
<Company_Module>
<files>
<default>Company_Module.csv</default>
</files>
</Company_Module>
</modules>
</translate>
<layout>
<updates>
<pstorelocator module="Company_Module">
<file>pstorelocator.xml</file>
</pstorelocator>
</updates>
</layout>
</frontend>
<admin>
<routers>
<pstorelocatoradmin>
<use>admin</use>
<args>
<module>Company_Module</module>
<frontName>pstorelocatoradmin</frontName>
</args>
</pstorelocatoradmin>
</routers>
</admin>
<adminhtml>
<menu>
<perception>
<title>Perception</title>
<sort_order>71</sort_order>
<children>
<!--<pstorelocator translate="title" module="pstorelocator">
<title>Advance Store Locator</title>
<sort_order>3</sort_order>
<action>pstorelocatoradmin/adminhtml_location/</action>
</pstorelocator>-->
</children>
</perception>
</menu>
<acl>
<resources>
<admin>
<children>
<pstorelocator>
<title>Perception</title>
<sort_order>71</sort_order>
<children>
<!--<pstorelocator translate="title" module="pstorelocator">
<title>Advance Store Locator</title>
</pstorelocator>-->
</children>
</pstorelocator>
<system>
<children>
<config>
<children>
<pstorelocator>
<title>Advance Store Locator</title>
</pstorelocator>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
<translate>
<!--<modules>
<Company_Module>
<files>
<default>Company_Module.csv</default>
</files>
</Company_Module>
</modules>-->
</translate>
</adminhtml>
<default>
<pstorelocator>
<general>
<google_geo_url><![CDATA[https://maps.google.com/maps/geo]]></google_geo_url>
<!--<show_search>1</show_search>-->
<show_map>0</show_map>
</general>
</pstorelocator>
</default>
</config>
0.2.6
公司模块模型
pstorelocator_mysql4
公司模块模型Mysql4
pstorelocator\u位置
公司模块
核心单元设置
核心写入
核心读取
公司\模块\助手
公司模块块
标准
公司模块
pstorelocator
Company_Module.csv
pstorelocator.xml
管理
公司模块
PStoreLocator管理员
感知
71
感知
71
高级存储定位器
0
基于您的正则表达式,您可以将匹配XML注释中任何字符的
替换为匹配除文字字符以外的任何字符的[^*]
:
(?s)<!--[^*]*?-->
(?s)
谢谢你的帮助,还有一件事,现在我必须在编辑器中打开“多行匹配”,我能避免这种情况并在代码本身中进行多行匹配吗?I。。我不知道你在说什么。可能是因为我不使用geany(这里只用于xml标记,甚至不用于正则表达式)。无论如何,我在你的问题中没有看到任何代码,除了XML,如果你愿意的话。。。