[英]I need to validate if first character of a string is a letter and next characters are either letters or numbers or special characters _,-,. and space
請注意:所有字符均為英文。
我試過Regex.IsMatch(item, @"^[a-zA-Z][a-zA-Z0-9_.-]+$")
但沒有按預期工作
Regex.IsMatch(item, @"^[a-zA-Z][a-zA-Z0-9_.-]*$")
'.' 之間有一個空格和 '-'
謝謝大家的建議。 我的示例輸入是:Vikash、Vikash kumar、Vikash。 庫馬爾,維卡什9_。 kumar <-這些應該得到支持
和
9Vikash,Vikash*hj,Vikash&9,%ghj <-這些不應該被支持
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.