jakarta-oro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "agi" <agic...@yahoo.com>
Subject substitue question
Date Wed, 02 Jan 2002 10:01:29 GMT
Hello,theres 
     I'm new in regex, I want to substitute the some patterns in a target text.
     input "xxxdef  yyydef  zzzdef";        
     output "xxxdef1 yyydef2 zzzdef3"
     here are my code, what's the regex ??
 
thanks a lot 

Rgds,
Agi

   

import java.io.*;
import org.apache.oro.text.perl.Perl5Util;

class test
{
  static int counter=1;
  public static void main(String[] args)
  {
    String s = "xxxdef  yyydef  zzzdef";        
    String regx = "s/(def)/$1 newID()/g";   //how to define the regx ??
    //                                    ^^^^^^  
    org.apache.oro.text.perl.Perl5Util p= new org.apache.oro.text.perl.Perl5Util();      
 
    System.out.println(p.substitute(regx,s));
         
  }

  static String newID()
  {
    return Integer.toString(counter++);
  }
  
}

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message