Created
March 22, 2018 14:52
-
-
Save aolo2/1f94c4f40d724c876902f6631ab3dbf5 to your computer and use it in GitHub Desktop.
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
import java.util.regex.*; | |
public class Lab3 { | |
private static void test_match(String text) { | |
String stringLiteral = "`(`{2}|[.\\s])*`"; | |
String numLiteral = "[0-9]+|[01]+b"; | |
String ident = "[\\?\\*\\|][0-9\\?\\*\\|]"; | |
String pattern = "(^" + stringLiteral + ")|(^" + numLiteral + ")|(^" + ident + ")"; | |
Pattern p = Pattern.compile(pattern); | |
Matcher m = p.matcher(text); | |
if (m.find()) { | |
// if (m.group(1) != null) | |
} else { | |
System.out.println("ERROR"); | |
} | |
} | |
public static void main(String args[]) { | |
test_match("`123123adsf2323fg2qy3h4wrhpidsrfug89u29jtwgv`"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment