System.out.println( ("Never gonna give you up, let you down, run around and desert you." + "\n" + "Bob Dole is a friend of the tobacco industry, likes your style,,,." ).replaceAll("(?m)(?<=^(\\w+ \\w+).*,)", "\n$1") );This prints (as seen on ideone.com)
Never gonna give you up, Never gonna let you down, Never gonna run around and desert you. Bob Dole is a friend of the tobacco industry, Bob Dole likes your style, Bob Dole, Bob Dole, Bob Dole.
No comments:
Post a Comment