How to add multiline option on RegularExpression attribute?

后端 未结 3 349
面向向阳花
面向向阳花 2021-01-18 19:37

I am using:

[RegularExpression(@\"^(\"\"|\\[)?[a-zA-Z0-9\']{1,125}(\"\"|\\])?$\")]

to make sure each line of a multiline textbox is properl

3条回答
  •  醉话见心
    2021-01-18 20:03

    You can add an inline option to enable MultiLine without having to add a RegexOptions overload to the Attribute. That also ensures the expression will work in Javascript as well.

        [RegularExpression(@"(?m)^(""|\[)?[a-zA-Z0-9']{1,125}(""|\])?$")]
    

提交回复
热议问题