如何使用mule过滤器过滤字符串中的通配符

如何使用mule过滤器过滤字符串中的通配符,mule,mule-studio,Mule,Mule Studio,我有价值/asdf。我想从字符串中拆分“/” 如何使用mule过滤器实现这一点?不确定我是否正确理解了您的问题,但要在mule中定义一个同时匹配“asdf”和“/asdf”的通配符过滤器,您只需 这应该可以: <flow name="test"> <http:inbound-endpoint exchange-pattern="request-response" host="0.0.0.0" port="8081" path="in"/>

我有价值/asdf。我想从字符串中拆分“/”


如何使用mule过滤器实现这一点?

不确定我是否正确理解了您的问题,但要在mule中定义一个同时匹配“asdf”和“/asdf”的通配符过滤器,您只需

这应该可以:

    <flow name="test">
        <http:inbound-endpoint exchange-pattern="request-response" host="0.0.0.0" port="8081" path="in"/>
        <scripting:transformer>
            <scripting:script engine="Groovy"><![CDATA[
                def p = java.util.regex.Pattern.compile("^/(.*)")
                def m = p.matcher(message.getPayload())
                if (!m.find()) throw new IllegalArgumentException('Message does not start with /')
                return m.group(1)
            ]]></scripting:script>
        </scripting:transformer>
</flow>


您需要做什么?是否筛选包含“/asdf”的消息?将“/asdf”消息拆分为“/”和“asdf”?从“/asdf”中删除“/”?我需要从字符串中筛选斜杠(/)。如果我将输入设为/asdf,意味着我的输出应该只包含asdfI,我只需要过滤输入中的斜杠。好的,那么您是说将有效负载从“/asdf”更改为“asdf”,而不是像上述文档中那样过滤?是这样吗?