SHOW:
|
|
- or go back to the newest paste.
| 1 | import java.util.regex.Pattern; | |
| 2 | import java.util.regex.Matcher; | |
| 3 | ||
| 4 | class Ideone | |
| 5 | {
| |
| 6 | public static void main (String[] args) throws java.lang.Exception | |
| 7 | {
| |
| 8 | - | Pattern pattern = Pattern.compile("(\\d+)((?:\\d{3})+)");
|
| 8 | + | Pattern pattern = Pattern.compile("\\b(\\d+)((?:\\d{3})+)\\b");
|
| 9 | Matcher matcher = pattern.matcher("sanyi1234 12345678910 másiksanyi12 142857142");
| |
| 10 | System.out.println( matcher.replaceAll("$1.$2") );
| |
| 11 | } | |
| 12 | } |