Created
November 9, 2015 07:51
-
-
Save akexorcist/1d8e3a1f6bfb28d6641f to your computer and use it in GitHub Desktop.
replace http://www.google.com with <a href="http://www.google.com">http://www.googl...</a>
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
stringmessage.replaceAll("\\(?\\b(http://|www[.])([-A-Za-z0-9+&@#/%?=~_()|!:,.;]{9})[-A-Za-z0-9+&@#/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#/%=~_()|]", "<a href=\"$0\">$2...</a>"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment