cvs commit: jakarta-oro/src/java/org/apache/oro/text/regex Perl5Substitution.java

[email protected]
Newsgroups gmane.comp.jakarta.oro.devel
Message-ID <[email protected]>
dfs         02/03/14 13:30:41

  Modified:    src/java/org/apache/oro/text/regex Perl5Substitution.java
  Log:
  Fixed bug where something like $&0 would be interpreted as -bash0.
  
  Revision  Changes    Path
  1.9       +9 -7      jakarta-oro/src/java/org/apache/oro/text/regex/Perl5Substitution.java
  
  Index: Perl5Substitution.java
  ===================================================================
  RCS file: /home/cvs/jakarta-oro/src/java/org/apache/oro/text/regex/Perl5Substitution.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Perl5Substitution.java	14 Mar 2002 21:12:53 -0000	1.8
  +++ Perl5Substitution.java	14 Mar 2002 21:30:41 -0000	1.9
  @@ -58,7 +58,7 @@
    */
   
   /*
  - * $Id: Perl5Substitution.java,v 1.8 2002/03/14 21:12:53 dfs Exp $
  + * $Id: Perl5Substitution.java,v 1.9 2002/03/14 21:30:41 dfs Exp $
    */
   import java.util.*;
   
  @@ -246,12 +246,7 @@
           
         // Save digits
         if (saveDigits) {
  -	int digit;
  -
  -	if(c == '&')
  -	  digit = 0;
  -	else
  -	  digit = Character.digit(c, 10);
  +	int digit = Character.digit(c, 10);
   
   	if (digit > -1) {
   	  if (posParam <= __MAX_GROUPS) {
  @@ -262,6 +257,13 @@
   	    __addElement(posParam);
   	  }
   	  continue;
  +	} else if(c == '&') {
  +	  if(/*current > 0 &&*/subChars[current - 1] == '$') {
  +	    __addElement(0);
  +	    posParam = 0;
  +	    saveDigits = false;
  +	    continue;
  +	  }
   	}
   
   	__addElement(posParam);
  
  
  

--
To unsubscribe, e-mail:   <mailto:[email protected]>
For additional commands, e-mail: <mailto:[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.