synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charith Wickramarachchi <charith.dhanus...@gmail.com>
Subject Re: Introducing regex flag support To the Filter mediator
Date Wed, 12 Jan 2011 07:00:54 GMT
On Wed, Jan 12, 2011 at 12:06 PM, Hiranya Jayathilaka
<hiranya911@gmail.com>wrote:

> HI Again,
>
> On Wed, Jan 12, 2011 at 12:03 PM, Hiranya Jayathilaka <
> hiranya911@gmail.com> wrote:
>
>> Hi Charith,
>>
>> On Wed, Jan 12, 2011 at 11:56 AM, Charith Wickramarachchi <
>> charith.dhanushka@gmail.com> wrote:
>>
>>> Hi ,
>>>
>>> If we look at the current Synapse filter mediator it does not support
>>> regex based filtering for multi-line Strings.
>>> IMO having that feature is useful  since there are scenarios where we
>>> need to do reg-ex filtering in multi-line Strings in message.
>>>
>>
>> +1 for fixing this. This is a limitation.
>>
>>
>>>
>>> So as a solution to that i thought of introducing  flag support to the
>>> Filter mediator with the regex matching. So users can optionally configure
>>> flags like
>>> MULTILINE , DOTALL , CASE_INSENSITIVE with the filter mediator.
>>>
>>> And also they will be able to use the combination of flags
>>>
>>> ex :
>>> DOTALL | CASE_INSENSITIVE
>>>
>>> after introducing this example filter mediator will look like this
>>>
>>> <filter source="." regex=".*connection.*" flag="DOTALL |
>>> CASE_INSENSITIVE" xmlns:m="http://www. <http://www.webserviceX.NET/>
>>
>>
> BTW this configuration looks a little odd. We may need to find a better way
> of doing this.
>
> Thanks,
> Hiranya
>
>
>> webserviceX.NET/ <http://www.webserviceX.NET/>">
>>>
>>> you can find more information in [1]
>>>
>>> I'm going of introduce following flags which i think is useful.
>>>
>>>    - MULTILINE
>>>    - DOTALL
>>>    - UNIX_LINES
>>>    - CASE_INSENSITIVE
>>>
>>> May I know how you came up with this list and what the rationale is?
>>
>>
Hi Hiranya ,

Java regex Pattern class contain many flags.If you look at the [1] that
article gives you the flags that will  needed for to support regex matching
on Muti-line  Strings so i included them .

I also thought of supporting CASE_INSENSITIVE one since that is useful.

And regarding the configuration change. that you commented on.
I used the same kind of syntax that java programmers use [2] . Since that
will be more user friendly to them.

Example :

    Pattern pattern = Pattern.compile(patternStr, Pattern.MULTILINE |
Pattern.CASE_INSENSITIVE);

So basically if users want multiple flags they can separate it with '|'
But if that ' | ' is confusing we can change it to a comma (' , ')

ex :
<filter source="." regex=".*connection.*" flag="DOTALL , CASE_INSENSITIVE"
xmlns:m="http://www. <http://www.webservicex.net/>

WDYT?

[2] http://www.roseindia.net/java/example/java/util/MultipleFlag.shtml

thanks,
Charith







> Thanks,
>> Hiranya
>>
>>
>>> If devs are ok i'll go head and add this feature to trunk.
>>>
>>> [1] http://www.javamex.com/tutorials/regular_expressions/multiline.shtml
>>>
>>> thanks,
>>> Charith
>>>
>>>
>>>
>>> --
>>> Charith Dhanushka Wickramarachchi
>>> http://charithwiki.blogspot.com/
>>>
>>>
>>
>>
>> --
>> Hiranya Jayathilaka
>> Senior Software Engineer;
>> WSO2 Inc.;  http://wso2.org
>> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
>> Blog: http://techfeast-hiranya.blogspot.com
>>
>
>
>
> --
> Hiranya Jayathilaka
> Senior Software Engineer;
> WSO2 Inc.;  http://wso2.org
> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
> Blog: http://techfeast-hiranya.blogspot.com
>



-- 
Charith Dhanushka Wickramarachchi
http://charithwiki.blogspot.com/

Mime
View raw message