最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

regex - Creating regular expression(s) which finds capitalization errors - Stack Overflow

programmeradmin5浏览0评论

This is a Sentence which contains
Some capitalization errors.

So far I have this: (?<![.!?]\s)(?<!^)(?<!\sI\s)(?!I['’][a-z])(?!\b(?:Dr|Mr|Mrs)\.[\s\r\n])\b(?!I\b)[A-Z]\w*

It will find "Sentence" in the above. It avoids hitting on I and I' contractions, and Dr. / Mr. / Mrs.

What I can't get it to do is find "Some" in the above.

I feel maybe a second expression might be better for document scanning, as the first expression is quite long and probably not optimized.

I need the expression to be PCRE compliant that avoids non fixed width errors and such.

Just can't solve this on my own unfortunately. As expected AI is no help here... the best models struggle with regular expressions unless they are more simple.

Tried many different RegEx's to match the word "Some" in the above. It should NOT match a preceding line that ends with a period, question mark, or exclamation point. It should also NOT match on I and I' contractions, or on Dr. / Mr. / Mrs.

发布评论

评论列表(0)

  1. 暂无评论