Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 import java.util.regex.Matcher;
- 2 import java.util.regex.Pattern;
- 3
- 4 public class Re {
- 5 public static void main(String[] args) {
- 6 String inputLine = "blah blah, uninteresting OU= 9623 stupid shit";
- 7 String pattern = " OU= ([0-9]{4})";
- 8
- 9 Pattern p = Pattern.compile(pattern);
- 10 Matcher m = p.matcher(inputLine);
- 11
- 12 if (m.find()) {
- 13 String match = m.group(1);
- 14
- 15 System.out.println("Found match: " + match);
- 16 }
- 17 }
- 18 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement