juneau-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shalitha Suranga <shalithasura...@gmail.com>
Subject Re: Adding PatternReplaceVar to svl core
Date Fri, 09 Nov 2018 03:48:11 GMT
Hi.. James

Yeah sure! I will add tests and update javadocs then send a pull request.
Yeah the special variable chars needs to be escaped :)

Thanks

On Fri, Nov 9, 2018 at 12:03 AM James Bognar <jamesbognar@apache.org> wrote:

> I like it.
>
> Go ahead and add unit tests and I'll merge it?  Note that if your regular
> expression contains "$", "{", or "}", these characters will need to be
> escaped with "\" so that they're not interpreted as part of the variable
> syntax.
>
> On Thu, Nov 8, 2018 at 12:45 PM Shalitha Suranga <
> shalithasuranga@gmail.com> wrote:
>
>> Hi..
>>
>> If developer needs to replace some characters or erase some characters
>> from a variable
>>  is hard with current variables I think.
>>
>> How about adding PatternReplaceVar ? I have my test work here
>> <https://github.com/apache/juneau/compare/master...shalithasuranga:patch004>
>>  (diff)
>>
>> Here are several examples
>>
>> VarResolver.DEFAULT.resolve("$PR{apple, ^a, A}"); // simply return Apple
>>
>> VarResolver.DEFAULT.resolve("Java version=$PR{$S{java.version},
>> (_([0-9]+)), \\ build=\\$2}");
>>
>> // return Java version=1.8.0 build=191 using back reference
>>
>> Can we introduce this feature. your ideas?
>>
>> Notice - unit cases and javadoc is not added for this test work
>>
>> Thanks
>>
>>
>>
>> --
>> Regards,
>> *Shalitha Suranga*
>>
>>
>>

-- 
Regards,
*Shalitha Suranga*

Mime
View raw message