大多数时候,人们只是在评论中提供正则表达式匹配的内容。但是,通过浏览Go源代码,我发现了一个有趣的示例:
// removeRE is the list of patterns to skip over at the beginning of a// message when looking for message text.var removeRE = regexp.MustCompile(`(?m-s)A(` + // Skip leading "Hello so-and-so," generated by prereview plugin. `(Hello(.|n)*?nn)` + // Skip quoted text. `|((On.*|.* writes|.* wrote):n)` + `|((>.*n)+)` + // Skip lines with no letters. `|(([^A-Za-z]*n)+)` + // Skip links to comments and file info. `|(http://prereview.*n([^ ]+:[0-9]+:.*n)?)` + `|(File .*:n)` + `)`,)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)