In message <[EMAIL PROTECTED]>, "Ulla (Ulrike) Schat" writes:
>But now I saw that from the ending of the input String "...-}", it 
>leaves the "-" which should not be included in the result.

Only you understand exactly what you're trying to do.  Given some thought,
I'm sure you can come up with an expression that does what you want based
on the previous example.  For example, I don't know if you really don't
want to consume -} in the input.  If it's okay to consume it, it's more
efficient to write:
  String regexp_pattern = "{(\\d+):([^}]+)-}";

That takes care of the - at the end of the second captured group.  Also,
you don't have to use regular expressions to do all the dirty work.  It's
easy enough to lop off the end of a match.  For example, if for some reason
you had
  String regexp_pattern = "{(\\d+):([^}]+-})";
you can alwasy trim the last two characters.  However, assuming you don't
want to consume the -}, changing the (?!-}) to (?!-)(?!}) prevents the
trailing dash that is followed by the brace from being included in the
captured group or being consumed as input (i.e., the next match attempt
in pmInput will start from the -}):
  String regexp_pattern = "{(\\d+):([^}]+)(?!-)(?!})";

daniel



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to