Dear all,
I want to ask that how to ignore all the special
characters ? For example, I want to replace "(2)" with
"[2]" , however, "(" is a special character. I need to
change "(2)" to "\\(2\\)" in order to achieve that.
I want a function that similar to :
result = fun( sourceString , "(2)" , "[2]" ) ;
my code:
private PatternMatcher matcher = new Perl5Matcher();
// engine
private Pattern pattern = null; // match pattern
private PatternCompiler compiler = new
Perl5Compiler(); // match pattern compiler
private Substitution substitute = null; //
substitute pattern
private PatternMatcherInput input = null ; // source
pattern
private int limit = Util.SUBSTITUTE_ALL ;
substitute = new Perl5Substitution( sub );
input = new PatternMatcherInput( source );
pattern = compiler.compile( regularExpression );
substitutions = Util.substitute( result,
matcher, pattern, substitute, input, limit );
System.out.print( "input=" + input + " output="
+ result );
Thx.
M.T.
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/