On Fri, 2005-03-04 at 18:20, Radha Sangal wrote:
> 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);
> 

http://www.weitz.de/regex-coach/

Useful tool for learning / debugging regular expressions.

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

Reply via email to