Fung David wrote: > > s1 = "abc const const xyz" > s2 = "abc const\nconst xyz" > > re = /abc.*xyz/ > md = re.match(s1) -> match found > md = re.match(s2) -> match not found > > how can i write the regexp to match s2? > > many thanks! > -david Add the /m switch to your regexp specification: re = /abc.*xyz/m Equivalent to: re = Regexp.new("abc.*xyz",Regexp::MULTILINE)