关于java正则

来源:互联网 发布:重生之网络娱乐无错 编辑:程序博客网 时间:2024/05/17 22:48

1. 需要排除时使用断言 

private String a; 匹配

return a;  排除

[\n \t]*(private|protected|public)?[\n \t]*(?!return)(String|boolean|int|float|double|[a-zA-Z0-9<>_]+)[\n \t]*(([a-zA-Z0-9_]+))[\n \t]*;[\n \t]*

2. 贪婪 非贪婪


0 0
原创粉丝点击