Here it is , I tested this code with the values in comments at end of
statements and it was working but I think it doesn't work well with my
actual string...

CharSequence inputStr = "codebase='formbuilderocx.cab#version=4,2,0,0'
viewastext id='formbuilderocx' >"; // "a b c a b c";
         String patternStr = "[0-9][0-9]+(,[0-9][0-9]){3}"; //"a";
         String replacementStr = "3,7,0,5";
 
         // Compile regular expression
         Pattern pattern = Pattern.compile(patternStr);
 
         // Replace all occurrences of pattern in input
         Matcher matcher = pattern.matcher(inputStr);
         String output = matcher.replaceAll(replacementStr);
         System.out.println( "input" + inputStr);
         System.out.println( "output" + output);

-----Original Message-----
From: Mark Lundquist [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 04, 2005 1:17 PM
To: Ant Users List
Subject: Re: regular expression


On Mar 4, 2005, at 10:12 AM, Radha Sangal wrote:

> It never found/matched that expression in the string. Can anyone
please
> share a piece of code, where a regular expression matches what it 
> should
> and gives back the string.

Why don't you post your code, and then maybe someone can point out what 
is wrong with it.

cheers,
-ml-


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to