import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "\\@\\w{40}.(js|css)";
final String string = "/js/jquery.cycle.custom.min@48bbf3f9d2712e4e6d6b7b0ce1cc92cade858979.css\n"
+ "/js/jquery.cycle.custom.min@48bbf3f9d2712e4e6d6b7b0ce1cc92cade858979.js\n\n"
+ "http://128.1.10.202:9090/ec2/resources/styles/blueprint/src/reset@60ee89fe415ed91091b8e5b69667bcc111b559a2.css?\n"
+ "appended=/styles/blueprint/screen@e8844fdaab6e412af57dfbfa4856cfa9d1d5124c.css,/styles/blueprint/typography@c4d37f15a78c5e05900e8a38d6fe0a7c932dc55c.css,/styles/blueprint/plugins/buttons/screen@2438b502b8bcaf5df6e5afa2a1081ddb1fbdd46a.css,/styles/jqzoom@6bf4516d76e9833c7d08690457667beaaf080e9a.css,/styles/style@6f5eb8c2081050071fc62e1cadac92f6bfded2b6.css,/styles/buttons@7ae2d029c26451327feec447e7f7eb1f78bdb9b9.css,/styles/style-standard@a373e18822d0e82ad287d4177eee6e83c0179cf5.css,/styles/messi/messi@7b50c7a29f6de29b9bbb78f10d9a853463ee45b2.css,/styles/modal-dialogs@c869667938f54304f727b08a599c74e3f02386c1.css,/colorbox/colorbox@1317faafe6a53060469798eac153882078a879a3.css,/styles/jquery.ui.spinner@a6c7fcd296725410f350aecaa5dd7c9f217f764f.css,/styles/ui/custom-theme/jquery-ui-1.8.20.custom@4bd57bf992a9cf092102acf958de146ad6fc392d.css,/styles/ui/custom-theme/jquery-ui-timepicker@b98d7a4ea7717d42aab28bb41bccdd706bfd7096.css";
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