Reputation: 67
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 the 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;
Upvotes: 5
Views: 689