Skip to content

Instantly share code, notes, and snippets.

@tedyoung
Last active June 19, 2019 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tedyoung/d344fb9d89597943de54de0e92041164 to your computer and use it in GitHub Desktop.
Save tedyoung/d344fb9d89597943de54de0e92041164 to your computer and use it in GitHub Desktop.
replaceAll using DOTALL mode
String text =
"```\n" +
"public class Stock {\n" +
"\n" +
"}\n" +
"```\n";
text = text.replaceAll("(?s)```(.*?)```", "<pre>$1</pre>");
System.out.println(text);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment