On Monday, April 4, 2016 at 12:27:33 AM UTC+2, Michael Esser wrote:
>
> Hi there,
>
> I want to match the a, b, c in the following string: "[[a]]  [[b]] [[c]]"
>
> I use RegExp with this pattern:"/\\[\\[(.*)\\]\\]/";
>
> But this allway gives me: a]] [[b]] [[c
> The flags g, m didn't change anything.
>
> How must the pattern looks like, to find the innner values?
>

Quantifiers are "greedy" by default in regexps (both Java and JavaScript). 
You want a "reluctant" (non-greedy) quantifier here, so "\\[\\[(.*?)\\]\\]"
See 
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#quantifiers
 
and https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#reluc

Either that or (if that fits your problem-space) match "everything but a 
closing square bracket" instead of "everything": "\\[\\[([^]]*)\\]\\]"

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to