[nSLUG] sed question

Tony Abou-Assaleh taa at acm.org
Thu Dec 29 04:15:25 AST 2005

> Your expression might also contain a logic flaw, I can never remember
> whether + is a greedy match or not, but if it is .+ will match to the end of
> the line, which is cleary not what you want there.

The general rule for regexp matching is: longest-left-most match. It is
greedy. It is not greedy only in perl when followed by ? as in '.+?'.



Tony Abou-Assaleh
Lecturer, Computer Science Department
Brock University, St. Catharines, ON, Canada, L2S 3A1
Office: MC J215
Tel:    +1(905)688-5550 ext. 5243
Fax:    +1(905)688-3255
Email:  taa at acm.org
WWW:    http://www.cosc.brocku.ca/~taa/
----------------------[THE END]----------------------


More information about the nSLUG mailing list