Reputation: 35194
My pattern: \s^SID\d{3,}$\s
I want to allow any number of leading and trailing whitespaces, but it doesn't seem to work. What did I miss?
Upvotes: 4
Views: 2411
Reputation: 71538
The \s
go after the beginning of line anchor and before the end of line anchor. After that, you need the *
quantifier.
^\s*SID\d{3,}\s*$
Upvotes: 4
Reputation: 10864
If you want whitespace to ALWAYS be there then:
^\s+SID\d{3,}\s+$
If you want whitespace to be OPTIONAL then:
^\s*SID\d{3,}\s*$
Note that if you put a plus after anything it means "1 or more" whereas an asterisk means "zero or more".
Upvotes: 6