On Wed, Oct 05, 2011 at 07:52:18PM +0200, Lřseth Tor Rafsol wrote:
> 
> On Oct 5, 2011, at 7:29 PM, Ronald J Kimball wrote:
> 
> > If you think about it another way, you want to find words that are either
> > 1-5 characters long or 7+ characters long:
> > 
> > ^(?:\w{1,5}|\w{7,})$
> 
> Thank you for that one Ronald, it did the trick :)
> 
> But are there really no other way to do it with a caret or assertion? 
> Just to keep complexity/readability down. Not that this one qualified for 
> that ;-)
> 

Here's a way to do it with a negative-lookahead assertion:

^(?!\w{6}$)\w+$

By caret, I assume you mean a negated character class [^...].  A character
class always matches or rejects exactly one character, so it doesn't apply
here.

Ronald

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to