I created the following regular expression:
(^[%a-zA-Z][\w\-.]+)( [\w\-.]+|[\w\-.]+)([%A-Za-z.]$)

which should be allowed, for example.
test (working)
test test (working)
%test (working)
test% (working)
%test% (working)
% (not working)
I tried the following: make% only works:
(%|(^[%a-zA-Z][\w\-.]+)( [\w\-.]+|[\w\-.]+)([%A-Za-z.]$))

a certain template works fine with https://www.debuggex.com , but it crashes in my application where the model looks:
[Display(Name = "Publisher")]
[RegularExpression(@"(%|(^[%a-zA-Z][\w\-.]+)( [\w\-.]+|[\w\-.]+)([%A-Za-z.]$))", ErrorMessage = "Invalid Expression!")]
public string SoftwarePublisher { get; set; }
any advice would be helpful. thank you in advance
source
share