Last active
March 10, 2019 12:16
-
-
Save ezhov-da/e953a43d19f6f68493749b9bf5d8c770 to your computer and use it in GitHub Desktop.
работа с группами
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.logging.Logger; | |
import java.util.regex.*; | |
public class TTest { | |
private static final Logger LOG = Logger.getLogger(TTest.class.getName()); | |
public static void main(String[] args) { | |
Pattern pattern = Pattern.compile("(?<user>[a-z]+)(?<number>\\d+)"); | |
Matcher matcher = pattern.matcher("asfafa2123264asfafsa3f43431asfasf34"); | |
while (matcher.find()) { | |
String user = matcher.group("user"); | |
System.out.println("user: " + user); | |
String number = matcher.group("number"); | |
System.out.println("number: " + number); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment