------ art_7521_27313026.1137482234873 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Thanks very much, I really appreatiate your help It does work, but I couldn't figure out what the ^ and * do? could you explain that in more detail? Thanks 2006/1/17, ara.t.howard / noaa.gov <ara.t.howard / noaa.gov>: > > On Tue, 17 Jan 2006, Eric Luo wrote: > > > Thanks for your replay. > > > > To make the problem clear. > > I want to only change the regular expression, but not the code to > implement > > this function. > > Actually, the regular expression comes from a configurable table. I'll > be > > supposed to only have the privilege to update the table. > > > > So What I really want is a alternative way to in place of the regular > > expression > > (?<!STR )SNPB > > harp:~ > cat a.rb > strings = "STR SNPB", "STR", "SNPB" > > re = %r/^ (?: (?:[^S]) | (?:S[^T]) | (?:ST[^R]) )* SNPB /ox > > strings.each do |string| > permutations = string, "foo #{ string }", "#{ string } bar", "foo #{ > string } bar" > permutations.each do |permutation| > puts "<#{ permutation }> matches" if re.match permutation > end > end > > harp:~ > ruby a.rb > <SNPB> matches > <foo SNPB> matches > <SNPB bar> matches > <foo SNPB bar> matches > > hth. > > -a > -- > strong and healthy, who thinks of sickness until it strikes like > lightning? > preoccupied with the world, who thinks of death, until it arrives like > thunder? -- milarepa > > > ------ art_7521_27313026.1137482234873--