I'm using this regex to lowercase prepositions, conjunctions, etc. in text files, and I want to add 2 exceptions: do not lowercase when $1 is preceded by ":" or preceded by "-". What is 开发者_如何学Gothe proper, concise way to do that. Thanks.
s/(\s(?:a|about|an|and|at|by|for|from|in|is|it|of|on|the|to|with))\b/\L$1/gi;
Add a negated look-behind before $1
:
(?<![:-])
精彩评论