[英]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.