如何删除特定数据以及尖括号

时间:2016-01-13 20:11:31

标签: regex outsystems

我需要从xml文件中删除特定数据以及数据,我尝试了很多,但无法获得正确的方法。请帮帮我。

示例输入:

[2016-01-13 15:28:05,052] ERROR {org.jaggeryjs.hostobjects.ws.WSRequestHostObject} -  Error occured while invoking the serviceorg.apache.axis2.AxisFault: namespace mismatch require http://services.mgt.tenant.carbon.wso2.org found http://schemas.xmlsoap.org/soap/envelope/
    at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
    at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:367)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:413)
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:224)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
    at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:554)
    at org.jaggeryjs.hostobjects.ws.WSRequestHostObject.jsFunction_send(WSRequestHostObject.java:362)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
    at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:386)
    at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)

    at org.jaggeryjs.rhino.jtest.c32._c_tenant_1(/jtest//index.jag:16)
    at org.jaggeryjs.rhino.jtest.c32.call(/jtest//index.jag)
    at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:74)
    at org.jaggeryjs.rhino.jtest.c32._c_script_0(/jtest//index.jag:24)
    at org.jaggeryjs.rhino.jtest.c32.call(/jtest//index.jag)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
    at org.jaggeryjs.rhino.jtest.c32.call(/jtest//index.jag)
    at org.jaggeryjs.rhino.jtest.c32.exec(/jtest//index.jag)
    at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:577)
    at org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:280)
    at org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:298)
    at org.jaggeryjs.jaggery.core.JaggeryServlet.doGet(JaggeryServlet.java:24)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:690)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:477)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:369)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
    at org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:172)
    at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
[2016-01-13 15:28:05,058] ERROR {JAGGERY.index:jag} -  JavaException: org.jaggeryjs.scriptengine.exceptions.ScriptException: Error occured while invoking the service

预期产出:

<isOurAccount>false</isOurAccount><maturityDate/><openedDate/><valuationAmount>0<valuationAmount><value>0</value>

类似于模式<isOurAccount>false</isOurAccount><valuationAmount>0<valuationAmount><value>0</value>

的其他元素

无法获取特定的正则表达式。

由于

1 个答案:

答案 0 :(得分:1)

使用简单的RegEx替换操作替换为空“”所有出现的<[a-zA-Z]+ *\/>都应该足够了。

https://regex101.com

中检索到的RegEx说明
  

<字面匹配字符<

     

[a-zA-Z]+匹配下面列表中的单个字符

     

量词:+在一次和无限次之间,尽可能多次,根据需要回馈[贪婪]

     

a-z a和z之间范围内的单个字符(区分大小写)

     

A-Z A和Z之间范围内的单个字符(区分大小写)

     

(space)*字面匹配空格字符

     

量词:*在零和无限次之间,尽可能多次,根据需要回馈[贪婪]

     

\/字面上匹配转义字符/

     

>字面匹配字符>