Regex Filter in Mule
The RegEx Filter applies a regular expression pattern, such as a pattern that includes wildcards or other character substitution symbols, to the message payload. The filter applies the toString() method to the payload to convert the payload to a String. To ensure that the payload is a String, you might want to apply a Payload Filter to the message with a nested And Logic Filter.
Regex filter filters payload on the basis of regex expressions.
flow of regex filter :
regex filter configuration :
I have given a simple regex expression. you can give as you want to give
URL : http://localhost:8085/api/regexfilter
Input :
Output :
XML project code :
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8085" basePath="/api" doc:name="HTTP Listener Configuration"/>
<flow name="test_regexfilterFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/regexfilter" doc:name="HTTP"/>
<regex-filter pattern="[a-zA-Z]" doc:name="Regex"/>
</flow>
</mule>
No comments:
Post a Comment