c# - Create validation for CSV and Text file only (case insenstive) -
this question has answer here:
- c# regex: ignore case… in pattern? 1 answer
i wants upload file extension .csv , .txt , case insensitive.
for example .csv, .csv, .csv, .txt, .txt , .txt ...
i using one
(?i)[.](csv|txt)
but not work when extension case-sensitive.
this regex in both client side , server side validation:
^.*\.([cc][ss][vv]|[tt][xx][tt]??)$
if want atleast 1 character name (before .txt or .csv) following help:
^.+\.([cc][ss][vv]|[tt][xx][tt]??)$
Comments
Post a Comment