Синтаксис сочетания рисунков Java, избирательно не способный к распознаванию строкJAVA

Программисты JAVA общаются здесь
Anonymous
Синтаксис сочетания рисунков Java, избирательно не способный к распознаванию строк

Сообщение Anonymous »

Я использую сопоставление с шаблоном Java, чтобы выявить строки формы «xxx» ('xxx', 'xxx'). Я не буду только текст, то есть xxx < /p>

Это то, что я сейчас использую: < /p>

Pattern p = Pattern.compile("'(.*?)'\\('(.*?)','(.*?)'\\)\\.");
< /code>

Это может сопоставить это: < /p>

'prevents'('scurvy','vitamin C').
'contains'('vitamin C','orange').
'contains'('vitamin C','sauerkraut').
'isa'('fruit','orange').
'improves'('health','fruit').
< /code>

Но не способен распознать это, хотя они отформатированы одинаково. < /p>

'take place in'('the grand hall of the hong kong convention', 'the ceremony').
'attend by'('some # guests', 'the grand hall of the hong kong convention').
'seat on'('the central dais', 'principal representatives of both countries').
'be'('mr jiang', 'representing china').
'be'('hrh', 'britain').
'be more than'('# distinguished guests', 'the principal representatives').
'end with'('the playing of the british national anthem', 'hong kong').
'follow at'('the stroke of midnight', 'this').
'take part in'('the ceremony', 'both countries').
'start at about'('# pm', 'the ceremony').
'end about'('# am', 'the ceremony').
'lower'('the british hong kong flag', '# royal hong kong police officers').
'raise'('the sar flag', 'another #').
'leave for'('the royal yacht britannia', 'the #').
'hold by'('the chinese and british governments', 'the handover of hong kong').
'rise over'('this land', 'the regional flag of the hong kong special administrative region of the people \'s republic of china').
'cast eye on'('hong kong', 'the world').
'hold on'('schedule', 'the # governments').
'be festival for'('the chinese nation', 'this').
'go in'('the annals of history', 'july # , #').
'become master of'('this chinese land', 'the hong kong compatriots').
'enter era of'('development', 'hong kong').
'remember'('mr deng xiaoping', 'history').
'be along'('the course', 'it').
'resolve'('the hong kong question', 'we').
< /code>

Какова причина? Как regexr.com
или какая -то простая понятная документация также была бы хорошей, результаты моего поиска в Google были очень фрагментарными и непоследовательными. < /p>

Подробнее здесь: https://stackoverflow.com/questions/281 ... ecognition

Вернуться в «JAVA»