import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "(?:github.com)(.*)";
final String string = "# [JSBox ](https://github.com/axelburks/JSBox?files=1) script\n"
+ "/\n"
+ " [Extract Scheme](https://github.com/axelburks/JSBox/tree/master/Extract%20Scheme) \n"
+ " [over 1 year ago](https://github.com/axelburks/JSBox/tree/master/Extract%20Scheme) [Launcher](https://github.com/axelburks/JSBox/tree/master/Launcher) \n"
+ " [over 1 year ago](https://github.com/axelburks/JSBox/tree/master/Launcher) [Magic Launcher](https://github.com/axelburks/JSBox/tree/master/Magic%20Launcher) \n"
+ " [8 months ago](https://github.com/axelburks/JSBox/tree/master/Magic%20Launcher) [Schedule Message](https://github.com/axelburks/JSBox/tree/master/Schedule%20Message) \n"
+ " [over 1 year ago](https://github.com/axelburks/JSBox/tree/master/Schedule%20Message) [XPin](https://github.com/axelburks/JSBox/tree/master/XPin) \n"
+ " [3 days ago](https://github.com/axelburks/JSBox/tree/master/XPin) [iTunes Utilities](https://github.com/axelburks/JSBox/tree/master/iTunes%20Utilities) \n"
+ " [6 months ago](https://github.com/axelburks/JSBox/tree/master/iTunes%20Utilities) [Boom.js](https://github.com/axelburks/JSBox/blob/master/Boom.js) \n"
+ " [almost 2 years ago](https://github.com/axelburks/JSBox/blob/master/Boom.js) [Clip Editor.js](https://github.com/axelburks/JSBox/blob/master/Clip%20Editor.js) \n"
+ " [about 1 year ago](https://github.com/axelburks/JSBox/blob/master/Clip%20Editor.js) [Downloader.js](https://github.com/axelburks/JSBox/blob/master/Downloader.js) \n"
+ " [over 1 year ago](https://github.com/axelburks/JSBox/blob/master/Downloader.js) [Emoji.js](https://github.com/axelburks/JSBox/blob/master/Emoji.js) \n"
+ " [almost 2 years ago](https://github.com/axelburks/JSBox/blob/master/Emoji.js) [IPA Installer.js](https://github.com/axelburks/JSBox/blob/master/IPA%20Installer.js) \n"
+ " [about 2 months ago](https://github.com/axelburks/JSBox/blob/master/IPA%20Installer.js) [Installer.js](https://github.com/axelburks/JSBox/blob/master/Installer.js) \n"
+ " [over 1 year ago](https://github.com/axelburks/JSBox/blob/master/Installer.js) [Pushbullet.js](https://github.com/axelburks/JSBox/blob/master/Pushbullet.js) \n"
+ " [about 1 year ago](https://github.com/axelburks/JSBox/blob/master/Pushbullet.js) [README.md](https://github.com/axelburks/JSBox/blob/master/README.md) \n"
+ " [about 2 months ago](https://github.com/axelburks/JSBox/blob/master/README.md) [SM.MS.js](https://github.com/axelburks/JSBox/blob/master/SM.MS.js) \n"
+ " [over 1 year ago](https://github.com/axelburks/JSBox/blob/master/SM.MS.js) [Shorten.js](https://github.com/axelburks/JSBox/blob/master/Shorten.js) \n"
+ " [about 1 year ago](https://github.com/axelburks/JSBox/blob/master/Shorten.js) [Thunder.js](https://github.com/axelburks/JSBox/blob/master/Thunder.js) \n"
+ " [about 1 year ago](https://github.com/axelburks/JSBox/blob/master/Thunder.js) [Tool Box play_icon.png](https://github.com/axelburks/JSBox/blob/master/Tool%20Box%20play_icon.png) \n"
+ " [almost 2 years ago](https://github.com/axelburks/JSBox/blob/master/Tool%20Box%20play_icon.png) [Tool Box.js](https://github.com/axelburks/JSBox/blob/master/Tool%20Box.js) \n"
+ " [over 1 year ago](https://github.com/axelburks/JSBox/blob/master/Tool%20Box.js) [Weico.js](https://github.com/axelburks/JSBox/blob/master/Weico.js) \n"
+ " [almost 2 years ago](https://github.com/axelburks/JSBox/blob/master/Weico.js) [XQRcode.js](https://github.com/axelburks/JSBox/blob/master/XQRcode.js) \n"
+ " [about 1 year ago](https://github.com/axelburks/JSBox/blob/master/XQRcode.js) [updateInfo](https://github.com/axelburks/JSBox/blob/master/updateInfo) \n"
+ " [over 1 year ago](https://github.com/axelburks/JSBox/blob/master/updateInfo) [version.json](https://github.com/axelburks/JSBox/blob/master/version.json) \n"
+ " [about 2 months ago](https://github.com/axelburks/JSBox/blob/master/version.json) ";
final String subst = "";
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
final Matcher matcher = pattern.matcher(string);
// The substituted value will be contained in the result variable
final String result = matcher.replaceAll(subst);
System.out.println("Substitution result: " + result);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html