From: David Alan Black Date: 2002-08-01T02:26:13+09:00 Subject: Re: Individual elements of regular expressions Hi -- On Thu, 1 Aug 2002, Maur�cio wrote: > > > > > How do I say: in a set of (number G number number1 number number > > > end-of-line --CONT- number number2 number number end-of-line), I want to > > > know number1 and number2? > > > > (...) > > I think you want backreferences. If you parenthesize > > part of a regex, then you can retrieve it afterward > > (...) > > Great! That's exactly what I want. There's only one missing point: how > to insert a line break in a regular expression. I tried /.*$\-CONT-/, but it > didn't work. You can always use "\n", and if you use the /m modifier: /regexp/m then the wildcard dot will match \n's. So, given a two-line string: 1182001 G -5.862926E-06 -4.551246E-04 -8.286275E-07 876 -CONT- -8.112655E-06 -3.389444E-08 5.149248E-06 877 these will both succeed: /.+\n-CONT-/.match(line) /.+-CONT-/m.match(line) David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav