java中两个尖括号时什么_Java-删除双尖括号中包含的块的正
则表达式
我只想剪裁完所有的好,直到佛罗伦萨.这意味着切断所有许可证.
我该如何写表达式?
<
SHAKESPEARE IS COPYRIGHT 1990-1993 BY WORLD LIBRARY, INC., AND IS
PROVIDED BY PROJECT GUTENBERG ETEXT OF ILLINOIS BENEDICTINE COLLEGE
WITH PERMISSION. ELECTRONIC AND MACHINE READABLE COPIES MAY BE
DISTRIBUTED SO LONG AS SUCH COPIES (1) ARE FOR YOUR OR OTHERS
PERSONAL USE ONLY, AND (2) ARE NOT DISTRIBUTED OR USED
COMMERCIALLY. PROHIBITED COMMERCIAL DISTRIBUTION INCLUDES BY ANY
SERVICE THAT CHARGES FOR DOWNLOAD TIME OR FOR MEMBERSHIP.>>
ALLS WELL THAT ENDS WELL
by William Shakespeare
Dramatis Personae
KING OF FRANCE
THE DUKE OF FLORENCE
BERTRAM, Count of Rousillon
LAFEU, an old lord
PAROLLES, a follower of Bertram
TWO FRENCH LORDS, serving with Bertram
STEWARD, Servant to the Countess of Rousillon
LAVACHE, a clown and Servant to the Countess of Rousillon
A PAGE, Servant to the Countess of Rousillon
COUNTESS OF ROUSILLON, mother to Bertram
HELENA, a gentlewoman protected by the Countess
A WIDOW OF FLORENCE.
时间正则表达式javaDIANA, daughter to the Widow
VIOLENTA, neighbour and friend to the Widow
MARIANA, neighbour and friend to the Widow
Lords, Officers, Soldiers, etc., French and Florentine
<
SHAKESPEARE IS COPYRIGHT 1990-1993 BY WORLD LIBRARY, INC., AND IS
PROVIDED BY PROJECT GUTENBERG ETEXT OF ILLINOIS BENEDICTINE COLLEGE
WITH PERMISSION. ELECTRONIC AND MACHINE READABLE COPIES MAY BE DISTRIBUTED SO LONG AS SUCH COPIES (1) ARE FOR YOUR OR OTHERS
PERSONAL USE ONLY, AND (2) ARE NOT DISTRIBUTED OR USED
COMMERCIALLY. PROHIBITED COMMERCIAL DISTRIBUTION INCLUDES BY ANY SERVICE THAT CHARGES FOR DOWNLOAD TIME OR FOR MEMBERSHIP.>>
解决⽅法:
在这种特定情况下,我的意思是“仅针对此特定输⼊”,您可以将其与以下内容匹配:
>>([[^
确保您正在使⽤的任何实现都⽀持在字符串中间⽽不是仅在开头进⾏匹配.括号代表捕获组.
如果您需要获得不在该组中的测试,则可以使⽤:
([[^>]>)> [^
现在,两个捕获组具有所需的⽂本.
编辑:由于您使⽤的是Java,请确保在第⼀种情况下使⽤Matcher.find()⽽不是Matcher.matches().标签:java,regex
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论