Regex in DataAnnotations that can unmatch a input string containing not paired double quote "
-
Dear experts, I want to write a Regex in DataAnnotations that can unmatch a input string containing not paired double quote " ie. check if zero or a paired double quote allowed in a input string. pls kindly advise. thx matched case: abcde "abcde" abc"d"e unmatched case: "abc"de" "abcde abc"de abcde" MY EXISTING CODE FYR:
...
using System.ComponentModel.DataAnnotations;
using Microsoft.Web.DynamicData;...
namespace EDMModel
{
[MetadataType(typeof(DETAIL_MetaData)), ScaffoldTable(true)]
public partial class DETAIL{}public class DETAIL\_MetaData { \[Required, RegularExpression(@"\[^~\`!@#%&()={}|:;'<>,./+?\*^$\]\*", ErrorMessage = "Unsupported Character detected"), StringLength(20), Display(Order = 21)\] public object NAME1 { get; set; }
...
....
-
Dear experts, I want to write a Regex in DataAnnotations that can unmatch a input string containing not paired double quote " ie. check if zero or a paired double quote allowed in a input string. pls kindly advise. thx matched case: abcde "abcde" abc"d"e unmatched case: "abc"de" "abcde abc"de abcde" MY EXISTING CODE FYR:
...
using System.ComponentModel.DataAnnotations;
using Microsoft.Web.DynamicData;...
namespace EDMModel
{
[MetadataType(typeof(DETAIL_MetaData)), ScaffoldTable(true)]
public partial class DETAIL{}public class DETAIL\_MetaData { \[Required, RegularExpression(@"\[^~\`!@#%&()={}|:;'<>,./+?\*^$\]\*", ErrorMessage = "Unsupported Character detected"), StringLength(20), Display(Order = 21)\] public object NAME1 { get; set; }
...
....
Not exactly sure how it is in DataAnnotations, but the regexp would be:
^[^"]*("[^"]*")*[^"]*$
If you have further character limitations, you could put them in instead of just [^"]