c# - RegEx Get Error Message -


i new @ regex , wondering if there way display error messages user such he/she did wrong using regex. there hypotetical regex.geterromessage thing? user enters string , match regex pattern, if there no match show error.

let have such expression ^[0-9]{0,8}$. far understood expression telling match on digits number length less or equal 8. problem user have entered letter or he/she entered more 8 digits.

can error message somehow regex or have write own each case?

if want message user-friendly, have write own message every regex check.

even if regex point specific character in input, message spooky,

incorrect character @ position 7 expression ^[0-9]{0,8}$ 

a better option use masked input in ui, user cannot enter anything, digits.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -