Reputation: 113
I have this regex -: /@[a-zA-Z ]+/g;
Clearly, this would match @abs
as well as it would match
@ abs
. But I dont want the latter to match cuz it has a space character
before a letter
. My regex should only match those where space is preceeded by a letter.
How to do that?
Upvotes: 2
Views: 139
Reputation: 854
putting [a-zA-Z]
after the @ would force a letter there:
/@[a-zA-Z][a-zA-Z ]*/g;
Upvotes: 4