multiregexp
multiregexp copied to clipboard
Java library to check for multiple regexp with a single deterministic automaton. Just a wrapper around dk.brics.automaton really.
When I use the Searching for regular email: "[A Za - z0 - _ - 9] + @ [A Za - z0 - _ - 9] + (\. [A Za...
regexp: (.*)的(?:联系方式|电话|电话号码|手机号) string: david的联系方式 result: can not match code: List strRegList = new ArrayList(5); strRegList.add("(.*)的(?:联系方式|电话|电话号码|手机号)"); int [] subList = MultiPattern.of(strRegList).matcher().match("david的联系方式");
Using Java Pattern, I used to have something like this: ``` public String getAttributeFromMessage(String receiveData, Pattern patternToSearch) { Matcher matcher = patternToSearch.matcher(receiveData); if (matcher.find()) { return matcher.group(1); } return "";...
The automaton I create can be large (1GB+) and these can take a long time to create on slower systems so it's handy to be able to serialize them so...
Because a searcher is constructed by prefixing with `.*`, any patterns starting with `^` have that treated as a literal instead of a start of line anchor.