我想跳过所有字符,除非找到特定字符。例如对于以下字符串序列:
--dfdfdffdfdfefsd@ :
sdsdsdsadsad
hkkldjsfsdf , ! :
%ABC-1.[0-7]
我想要一个javacc正则表达式,除非找到%ABC-1.[0-7]
,否则它会跳过所有字符。
通常的正则表达式为.*?%ABC-1.[0-7]
,但是对于javacc,我发现类似~[]?%ABC-1.[0-7]
的东西。但这不起作用。
您能否提出与普通正则表达式.*?%ABC-1.[0-7]
等效的正确的javacc正则表达式?
谢谢
答案 0 :(得分:1)
如果您想要一个正则表达式来匹配所有字符,直到%ABC-1.[0-7]
,包括TOKEN { <FOO : (~[])* "%ABC-1.[0-7]" > }
,就可以这样做。
%ABC-1.[0-7]
如果您想要一个正则表达式匹配但不包括TOKEN { <CHAR : ~[]> }
TOKEN { <FOO : "%ABC-1.[0-7]" > }
,则不能这样做,因为JavaCC不允许使用正确的上下文。您可以做的是这样:
FOO
在任何一种情况下,您都可能希望在匹配[error] fault: Serious application error. An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:. attempt to delete row 1 from section 1 which only contains 1 rows before the update with userInfo (null)
CoreData: fault: Serious application error. An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:. attempt to delete row 1 from section 1 which only contains 1 rows before the update with userInfo (null)
令牌之后更改状态。