juneau-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Bognar <jamesbog...@apache.org>
Subject Re: Adding PatternReplaceVar to svl core
Date Thu, 08 Nov 2018 18:33:06 GMT
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*
>
>
>

Mime
View raw message