Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Vector;
- import java.util.Arrays;
- import java.util.regex.Pattern;
- import java.io.*;
- public class Regex {
- public static void main(String[] args) {
- final String ID = "[a-zA-z]+_*\\w*";
- final String IF_STMT = "cmp\\s*\\((?s).*\\)\\s*\\{(?s).*\\}\\s*";
- String input = "cmp(someExpression){anotherExpression}";
- String input2 = "Virus__1AJSHNZ";
- boolean b = Pattern.matches(ID, input2);
- System.out.println(b);
- /*
- String bool = "";
- String exp = "";
- for(int i = input.indexOf("("); i <= input.indexOf(")"); i++) {
- char[] temp;
- temp = input.toCharArray();
- bool+=temp[i];
- }
- System.out.println(bool);
- for(int i = input.indexOf("{"); i <= input.indexOf("}"); i++) {
- char[] temp;
- temp = input.toCharArray();
- exp+=temp[i];
- }
- System.out.println(exp);
- */
- }
- }
Add Comment
Please, Sign In to add comment