From: Nathan Clark Date: 2010-11-23T05:50:31+09:00 Subject: Re: Matching multiple line reg exp On Mon, Nov 22, 2010 at 3:45 PM, w_a_x_man wrote: > On Nov 22, 2:33 pm, Guillermo Riojas > wrote: >> Hi there, >> Trying for a couple of hours (again without success) to create a regular >> expression that matches a multi-line statement , i found myself here >> again, asking for help. >> The case is now: >> >> /123/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx >> xxxxxxxxxxxxxxxxxxxxxxxxxxxxx >> xxxxx >> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx >> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx >> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx >> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx >> xxxxxxxxxxxxxxxxxxxxx >> >> I am unable to match the statements that contains multiple lines. >> The regexp looks so far like this: >> >> /(\<[a-z][a-z][a-z]\>.*?$)/m >> >> The question is why is only returning matches until the first end of >> line? >> I am sure the greediness of the expression should take him to the last >> new line character just before the next statement comes, but maybe is >> just that i need to read a lot more to understand the concept right. >> In any case, can somebody point me what i am missing to run the scan >> method and get each match (including the ones with multiple lines)? >> >> Thanks a lot. >> >> -- >> Posted viahttp://www.ruby-forum.com/. > > /^(<[a-z]{3}>[^<]*)/ > > In multiline regular expressions in Ruby, the caret and dollar sign also match newlines in the string, which is why it only read a line at a time.