C#Regex获取字符串中的第一个字母,无论其大写还是小写 [英] C# Regex getting first letters in a string no matter if its upper or lower case
问题描述
嘿所有我肯定有人在这里有一个REGEX,允许挑出第一个字母,然后在那里找到任何其他大写字母。
一个例子是下面:
> supportLevel
它应该捕获 S 和 L 。
> softwareLicType
它应该捕获 S , L 和
T 。
> servManagerSubType
它应该捕获 S , M , S 和
T 。
即使它是这样的:
> poc
它应该只捕获 P 。
> > supportLevel
>哪个应该抓住S和L
从技术上讲,它会抓住s和L. 用文字思考: 第一个字符或任何资本:
  ^ |。[A-Z]
Hey all I am sure someone here has a REGEX that allows the first letter to be picked out and then find any other upper case letter there after.
An example is below:
> supportLevel
Which it should catch the S and L.
> softwareLicType
Which it should catch the S, L and T.
> servManagerSubType
Which it should catch the S, M, S and T.
Even if its like this:
> poc
Which it should catch only the P.
> >supportLevel
> Which is should catch the S and LTechnically, it would catch the s and L. Think about it in words: first char OR any capital:
^.|[A-Z]
这篇关于C#Regex获取字符串中的第一个字母,无论其大写还是小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!