Regex string

I use this regular expression for subordinate prepositions, conjunctions, etc. in text files, and I want to add 2 exceptions: do not enter lowercase letters if "$" precedes or "-" precedes $ 1. What is the right, concise way to do this. Thank.

s/(\s(?:a|about|an|and|at|by|for|from|in|is|it|of|on|the|to|with))\b/\L$1/gi;
+5
source share
1 answer

Add a negative appearance before $1:

(?<![:-])
+3
source

All Articles