I'm currently trying to create a software component that would be able to interprete dynamic strings such as:

```
%TO_LOWER%(%DELETE_WHITESPACES%("A SAMPLE TEXT"))

```

Which would result in this string:

```
asampletext

```

I would like to be able to define a set of available functions, with semantical parameters, etc.
I already know (more or less) how to do it using regular expressions.

My questions are:

* Is lexing/parsing way better than regexp for such a purpose, or should I just go with regexp and forget about that?
* Does such a library already exist in Java?
* Do you know any tutorial showing some sample parsing/lexing algorithms?

Thanks!