From: Robert Klemme Date: 2004-11-19T22:58:12+09:00 Subject: Re: Tales of the Regex (Re: About Regular Expressions) "James Britt" schrieb im Newsbeitrag news:419CF779.2080806@neurogami.com... > all substrings in a given set of substrings, irrespective of the order > of the substrings in either the target string or the set of ubstrings? ) Yes you can, but it's going to be uuuuugly and slooooow if you have more than two sub strings. A set of one regexp per sub string is likely to be more efficient: substrings = %w{foo bar baz} rxs = substrings.map {|s| Regexp.new(Regexp.escape(s))} string = "klajsd askdjkahs bar asjdajsd asdbazagdjhagsdh f0dfdfuufoosds" puts "Got it: #{string}" if rxs.all? {|rx| rx =~ string} > One a side note, I wonder what it would take to write a domain language, > parable by Ruby, that let one write REs in plain-ish English? Maybe > take some of the mystery out of regular expressions for most of the > common cases. (Or would that just get people dependent on too much > hand-holding?) Such a language with the same expressiveness as typical regexps would be too verbose for me. But I think I remember someone did something similar with Ruby. Can't quite remember who it was or a mail thread subject but I do believe someone has attempted to do something in that direction. Kind regards robert