On Wed, Oct 31, 2012 at 10:40:21AM -0600, LuKreme wrote: > I want to grep for words in a file that contain 'a' 'b' and 'c' in any order. > I also want to find words that contain two c's, even if not together (so > access and chance). > > I might even want words with two c's AND a and b, again in any order. > > I feel like I am forgetting something basic.
True regular expressions are not well-suited to finding substrings in arbitrary order. However, you could do this using look-ahead: (?i)(?=[a-z]*a)(?=[a-z]*b)(?=[a-z]*c[a-z]*c)([a-z]+) This regular expression works in Perl; I haven't tested it in BBEdit. 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>
