in java, but javascript is throwing an exception. The '+' after the
{2,} is a quantifier after a quantifier, it needs some sort of
character class before it. Depending on the goal of your match here
are some valid regex strings:
replaceAll("((<br>\\s*){2,})+", "<br>") matches: <br> <br> \n<br> <br>
doesn't match: <br><br><br> (only multiples of 2)
replaceAll("(<br>\\s*)+", "<br>") matches: <br> <br> \n<br> <br> (any
number of <br>'s separated by white space)
replaceAll("(<br>\\ *)+", "<br>") matches: <br> <br> <br> doesn't
match: <br> <br>\n<br> (only spaces, not all white space)
On Sep 30, 1:24 pm, Jan <jan.morl...@googlemail.com> wrote:
> Hi,
>
> I just stumbled upon a very weird problem. My gwt project (GWT
> 2.1.0.M3/AE 1.3.6) worked flawlessly in development mode. However
> after compiling, it failed. I was able to reduce the problem to the
> following minimal example:
>
> import com.google.gwt.core.client.EntryPoint;
> import com.google.gwt.user.client.Window;
>
> public class Compiletest implements EntryPoint {
>
> class AcceptorDTO {
> public String company;
> public String additionalInformation;
> }
>
> public void onModuleLoad() {
> AcceptorDTO acceptor = new AcceptorDTO();
> acceptor.company = "";
> acceptor.additionalInformation = "";
>
> String acceptorString = acceptor.company + "<br>" +
> acceptor.additionalInformation + "<br>";
>
> Window.alert(acceptorString);
> acceptorString = acceptorString.replaceAll("(<br> *){2,}+", "<br>");
> Window.alert(acceptorString);
> }
>
> }
>
> In development mode, two popups appear as expected. However the
> compiled versions shows only one. This means that the program aborts
> during the replaceAll function!
> In my opinion, this must not happen. However before I file a bug
> report, I would like to know if somebody can confirm or even explain
> this behaviour.
>
> Thanks in advance
> Jan
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment