Regexp

(replace all non alpha-numeric & space chars)
import java.util.regex.*;
...
      String input =" This is (&^@(#* J123unk";
      String patt = "[^A-Za-z0-9 ]+";
      Pattern p = Pattern.compile(patt);
      Matcher m = p.matcher(input);
      System.out.println(input);
      System.out.println(m.replaceAll(""));

-- MattWalsh - 10 Oct 2008

Topic revision: r1 - 10 Oct 2008 - MattWalsh
 
This site is powered by the TWiki collaboration platformCopyright © 2008-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback