import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "(\\ \\{|\\s+\\}|:(?= )|;)";
final String string = ".fixed-feedback-block {\n"
+ " position: fixed;\n"
+ " right: 0;\n"
+ " top: calc(50% - 33px);\n"
+ " cursor: pointer;\n"
+ " .inner {\n"
+ " text-indent: 10px;\n"
+ " }\n"
+ " svg {\n"
+ " width: 50px;\n"
+ " position: absolute;\n"
+ " top: 15px;\n"
+ " left: 0;\n"
+ " z-index: 85;\n"
+ " height: 20px;\n"
+ " }\n"
+ " .call-me-button {\n"
+ " width: 240px;\n"
+ " height: 50px;\n"
+ " display: block;\n"
+ " background: #f35556;\n"
+ " transform: translate3d(190px, 0, 0);\n"
+ " transition: transform 0.3s ease-out;\n"
+ " border: none;\n"
+ " box-shadow: none;\n"
+ " border-radius: 0;\n"
+ " &:hover {\n"
+ " transform: translate3d(0px, 0, 0)\n"
+ " }\n"
+ " }\n"
+ " .write-to-us-button {\n"
+ " width: 215px;\n"
+ " height: 50px;\n"
+ " background: #00a5b8;\n"
+ " float: right;\n"
+ " transform: translate3d(165px, 0, 0);\n"
+ " transition: transform 0.3s ease-out;\n"
+ " border: none;\n"
+ " box-shadow: none;\n"
+ " border-radius: 0;\n"
+ " &:hover {\n"
+ " transform: translate3d(0px, 0, 0)\n"
+ " }\n"
+ " }\n"
+ "}";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
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