On Tue, Nov 04, 2003 at 05:34:53PM -0800, Christopher Eykamp wrote: > How can I match the following: "s\.ex" and "se\.x" and "s\.e\.x" but not > "sex" without including all the possible permutations? Is there an elegant > solution?
Well, I have two thoughts on this. 1) you're trying to do something programatic (permutation), which regexp doesn't really do. I can't think of a "neat" way to do it. 2) the easiest route would be to use | and do the permutations. /s(?:e\.|\.e\.?)x/ Unless it's a really slow or complicated regexp, I try not to spend more time on it than necessary. -- Randomly Generated Tagline: "Kids... Can't live with 'em, can't shoot 'em." - From Grumpy Old Men
pgp00000.pgp
Description: PGP signature