Skip to content

Instantly share code, notes, and snippets.

@rkcb
Last active March 31, 2019 22:49
Show Gist options
  • Save rkcb/7b443f7615f66c886c5e484cd0dbfc78 to your computer and use it in GitHub Desktop.
Save rkcb/7b443f7615f66c886c5e484cd0dbfc78 to your computer and use it in GitHub Desktop.
Java common

Java common

Strings

Find a substring by a regular expression:

  String pattern = "(.*)(\\d\\d\\d\\d)(.*)";
  String line = "2018-11-22 00:00:00";
  Pattern re = Pattern.compile(pattern);
  Matcher matcher = re.matcher(line);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment