gpt4 book ai didi

C# 简单正则表达式 - 32 个字符,仅包含 0-9 和 a-f (GUID)

转载 作者:可可西里 更新时间:2023-11-01 03:04:02 24 4
gpt4 key购买 nike

如果出现以下情况,如何在 C# 中使用正则表达式进行测试:

  • 字符串的长度正好是32
  • 字符串只包含0-9的数字和a-f的小写字母

最佳答案

怎么样:

Regex regex = new Regex("^[0-9a-f]{32}$");
if (regex.IsMatch(text))
...

关于C# 简单正则表达式 - 32 个字符,仅包含 0-9 和 a-f (GUID),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4305129/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com