Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package regex;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- public class Main {
- public static void main(String[] args) {
- String s = "/t fred";
- matcher(s);
- }
- //(\w+)\.
- private static void matcher(String string) {
- System.out.println("\n\ntrying\n" + string + "\nmatches:");
- Pattern pattern = Pattern.compile("(\\w+)$"); //(\w+)\.
- Matcher matcher = pattern.matcher(string);
- String m = null;
- while (matcher.find()) {
- m = matcher.group();
- System.out.println(m);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment