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 (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