开发者

Regular expression lowercase

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:

(?<![:-])
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜