简体   繁体   English

小写字母或句点的正则表达式,后跟大写字母

[英]regex for lowercase letter or period followed by an uppercase letter

Originally I just wanted to find a lowercase letter followed by an uppercase letter, in which case [az][AZ] worked out pretty well. 最初,我只是想找到一个小写字母,然后是一个大写字母,在这种情况下, [az][AZ]效果很好。

However, in some cases the lowercase letter is replaced by a period. 但是,在某些情况下,小写字母由句点代替。 I'm fairly new to regex and haven't been able to find a way to implement this explicity in regex (my current solution runs through a few if statements and feels quite inelegant. 我对regex相当陌生,还无法找到在regex中实现此显式方式的方法(我当前的解决方案通过了一些if语句,感觉很不雅致。

Is this something that can be handled well by regex? 正则表达式可以很好地处理吗?

[a-z.][A-Z]

Read about character classes . 阅读有关字符类的信息 One character out of those specified is matched by it. 匹配指定字符中的一个字符。


Additionally: If you were using the . 此外:如果您使用. outside a character class, you would need to escape it as it is a regex meta-character. 在字符类之外,您需要对其进行转义,因为它是正则表达式元字符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Java中设置小写字母和大写字母之间的时间间隔 - Set period between lowercase letter followed by uppercase letter in Java 正则表达式查找HTML标记之间的小写字母和大写字母 - Regex to find a lowercase letter followed by an uppercase between a HTML tag 如果大写字母前面和后面跟着一个小写字母,则插入空格 - Python - Insert space if uppercase letter is preceded and followed by one lowercase letter - Python 正则表达式同时捕获大写和小写字母 - Regex to capture both uppercase and lowercase letter python 正则表达式查找小写字母后跟大写字母 - python regex find lowercase followed by capital letter 替换小写字母,句号和大写字母的正则表达式将是什么? - What will be the regex for replacing lowercase followed by period followed by uppercase? 正则表达式替换大写字母后的句点 - Regex to replace period after uppercase letter 需要在小写字母的每个实例之间立即插入一个制表符,然后紧跟一个大写字母 - Need to insert a tab in between every instance of a lowercase letter immediately followed by an uppercase letter 在bash / sed中,如何匹配小写字母后跟大写的相同字母? - In bash/sed, how do you match on a lowercase letter followed by the SAME letter in uppercase? 删除大写字母前的小写字母 - Removing lowercase letter before an uppercase letter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM