我有正則表達式的字符串,其格式應該像如何正則表達式,長度爲15的字符串爲特定圖案
Position Format
1st Numeric
2nd Numeric
3rd Alphabet
4th Alphabet
5th Alphabet
6th Alphabet
7th Alphabet
8th Numeric
9th Numeric
10th Numeric
11th Numeric
12th Alphabet
13th AlphaNumeric
14th AlphaNumeric
15th AlphaNumeric
然後終於有匹配,如果正則表達式是有效
Match match = Regex.Match(inputString, regex, RegexOptions.IgnoreCase);
if (inputString != string.Empty && match.Success)
{
// Condition
}
我實際上被卡住了。我正在使用c#。通過字符來檢查條件。但這看起來不是理想的解決方案。 請協助使用正則表達式/ C#
請參閱https://www.dotnetperls.com/regex – ThrowingSpoon
嘗試使用「@」^ [0-9] {2} [a-zA-Z] {5} [0-9] {4} [ a-za-z] [a-zA-Z0-9] {3} $「' –
快速嘗試一下你的正則表達式:http://regexr.com/ – ThrowingSpoon