Monday, April 4, 2016

Re: regexp with multiple machtes

Thank you, this work.
But only if I you is directly with JNI.
How must the pattern looks like to you use it with Java from GWT?

On Monday, April 4, 2016 at 2:13:12 AM UTC+2, Thomas Broyer wrote:

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 "\\[\\[(.*?)\\]\\]"

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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment