/^[ ]+Pin:[ ]*([^\.]*)\.([^ ]*)$/ --> Matches " Pin: U714.QN" $1 = U714 $2 = QN and /^[ ]+Pin:[ ]*([^\.]*)\.([^ ]*)[ ]out/ --> Matches " Pin: U713.INP out" $1 = U713 $2 = INP