I have a string which may have one of two formats:
(someName,true);(where someName can be any combination of letters and numbers, and after the comma we have eithertrueorfalse)(someName,true), (anything,false), (pepe12,true);and in this case, we can have as many parenthesis groups as can be, but they are separated with a comma plus white space.
Given the following test set:
(hola,false);
comosoy12,true);
caminare)
true,comoestas
I used the following regex ^\(.*,(true|false)[)][;$] and got my expected result of true, false, false, false (quick check here). But I cannot seem to come up with the regex for the following cases:
(someName,true), (anything,false), (pepe12,true);
(hola,false);
comosoy12,true);
(batman,true), (kittycat,false);
(batman,true); (kittycat,false);
Which should return true, true, false, true, false.
s.matches("^\\(\\w+,(?:true|false)\\)(?:, \\(\\w+,(?:true|false)\\))*;")ors.matches("^\\(\\w+,(?:true|false)\\)(?:,\\s+\\(\\w+,(?:true|false)\\))*;")