while (...) { if (some match) { do something with $1 } }