You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-user@jakarta.apache.org by Sven Herschel <sv...@gmx.net> on 2002/08/04 18:20:01 UTC

Reluctant Closure not compiling

Hello,
I'd like to pinpoint the place in an HTML document where the <body .....>
tag closes.
My first try, the regular expression

<html([\n\r\f]|.)*<body[^>]*(>)

compiles but takes forever to match (and I actually mean forever...). Then I
guessed that maybe a reluctant closure would provide the desired solution
and I rewrote it to:

<html([\n\r\f]|.)*?<body[^>]*?(>)

The RECompiler however, crashes with an ArrayIndexOutOfBoundsException
(stacktrace see below)

Does anyone have an idea?

Ciao
Sven



java.lang.ArrayIndexOutOfBoundsException
 at org.apache.regexp.RECompiler.setNextOfEnd(RECompiler.java:207)
 at org.apache.regexp.RECompiler.expr(RECompiler.java:1249)
 at org.apache.regexp.RECompiler.compile(RECompiler.java:1281)
 at org.apache.regexp.RE.<init>(RE.java:495)
 at org.apache.regexp.RE.<init>(RE.java:480)
 at navigation.AuxNav.setLocation(AuxNav.java:132)
 at java.lang.reflect.Method.invoke(Native Method)
 at
org.apache.struts.util.PropertyUtils.setSimpleProperty(PropertyUtils.java:98
8)
 at
org.apache.struts.util.PropertyUtils.setNestedProperty(PropertyUtils.java:90
4)
 at org.apache.struts.util.PropertyUtils.setProperty(PropertyUtils.java:932)

My method, setLocation, does nothing but.

 public void setLocation (String location) {
  try {
   this.location = new RE (location);
  } catch (RESyntaxException e) {
   logger.error ("SyntaxException occured while parsing location String");
   return;
  }
  this.originalLocation = location;
 }



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Reluctant Closure not compiling

Posted by Michael McCallum <mi...@snaphire.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yep theres a bug. Its fixed in cvs. Butno one has had the time or effort to make a release.
Ive just sorted out a new connection at home so you never know i might get around to it.

On Monday, 05 August, 2002 04:20, Sven Herschel wrote:
> Hello,
> I'd like to pinpoint the place in an HTML document where the <body .....>
> tag closes.
> My first try, the regular expression
>
> <html([\n\r\f]|.)*<body[^>]*(>)
>
> compiles but takes forever to match (and I actually mean forever...). Then
> I guessed that maybe a reluctant closure would provide the desired solution
> and I rewrote it to:
>
> <html([\n\r\f]|.)*?<body[^>]*?(>)
>
> The RECompiler however, crashes with an ArrayIndexOutOfBoundsException
> (stacktrace see below)
>
> Does anyone have an idea?
>
> Ciao
> Sven
>
>
>
> java.lang.ArrayIndexOutOfBoundsException
>  at org.apache.regexp.RECompiler.setNextOfEnd(RECompiler.java:207)
>  at org.apache.regexp.RECompiler.expr(RECompiler.java:1249)
>  at org.apache.regexp.RECompiler.compile(RECompiler.java:1281)
>  at org.apache.regexp.RE.<init>(RE.java:495)
>  at org.apache.regexp.RE.<init>(RE.java:480)
>  at navigation.AuxNav.setLocation(AuxNav.java:132)
>  at java.lang.reflect.Method.invoke(Native Method)
>  at
> org.apache.struts.util.PropertyUtils.setSimpleProperty(PropertyUtils.java:9
>8 8)
>  at
> org.apache.struts.util.PropertyUtils.setNestedProperty(PropertyUtils.java:9
>0 4)
>  at
> org.apache.struts.util.PropertyUtils.setProperty(PropertyUtils.java:932)
>
> My method, setLocation, does nothing but.
>
>  public void setLocation (String location) {
>   try {
>    this.location = new RE (location);
>   } catch (RESyntaxException e) {
>    logger.error ("SyntaxException occured while parsing location String");
>    return;
>   }
>   this.originalLocation = location;
>  }

- -- 
Michael McCallum
Software Engineer
SnapHire Inc.
ph: 649.308.0329
http://www.SnapHire.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9XB4liVyQAvn9zYsRAgMxAJ4/CEkXw5Dr2akr3GGd7mgTCs+SdwCeKqrt
usi6LqowG+oGKwAiuCet4uA=
=V+/H
-----END PGP SIGNATURE-----


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>