Java -Muster -Matcher -Syntax, selektiv unfähig zur ZeichenkennungJava

Java-Forum
Anonymous
 Java -Muster -Matcher -Syntax, selektiv unfähig zur Zeichenkennung

Post by Anonymous »

Ich verwende den Java -Muster -Matcher, um Zeichenfolgen der Form 'xxx' ('xxx', 'xxx') herauszufinden. Ich möchte nicht nur den Text, d. H. xxx < /p>

Das verwende ich derzeit: < /p>

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

Es ist in der Lage, dies zu entsprechen: < /p>

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

ist jedoch nicht in der Lage, dies zu erkennen, obwohl sie auf die gleiche Weise formatiert sind. < /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>

Was ist die Ursache dafür? Wie regexr.com
oder eine einfache verständliche Dokumentation wäre ebenfalls gut, die Ergebnisse meiner Google -Suche waren sehr fragmentarisch und inkohärent. < /P.>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post