I can search for a word in a string with regex as follows:
where regex is a string representing the word, and toCheck is the string to check. However, how can I check a string for separated chars? I want to check if a string contains square brackets and curly braces although there will be text between these chars. I know how to do this with indexOf method, but is there a way I can use regex to check for multiple chars in one statement? I was thinking something like "/[+/]+/{+/}" but not having any luck getting it to workPHP Code:Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(toCheck);
flag = m.find();


LinkBack URL
About LinkBacks
Reply With Quote
