I have the following requirements for string
- not allowed + - and = at the beginning of the field
- vertical slash | is not allowed at all for the word entry
- ignore spaces around the entry
^\s*[^\+\-\=|][^|]*\s*$ I've written this regex, I expected that it should work, but it doesn't. I've tried " +a" and it matches,it's incorrect. Removing [^|]* or * from \s* makes my regex more valid (" +a" not matches regex - it's correct), but I need a full valid regex but not partially valid
+amatched because the space was matched with[^\+\-\=|], maybe you want^\s*([^\s+=-|])[^|]*\s*$? That means, another requirement is no whitespace as the first char.