re = /(.*)\|[\s\t]+([0-9.,]+|)([\s\t]+|)\|(.*)/
str = '02.05.07| 158.73 |test1
02.05.07| 63,492.00|test2
| |Взнос наличными на счет
| |@@CP 00442 XXXXXXXXXXXXXX
| |КАРАГАНДИНСКИЙ Ф-Л
| |счет : 1101-879100-398
| |СЧЕТ КАССЫ
| |/KNP/1717311
| |ПОПОЛ СЧ ДОВ 322 ОТ 22,12,06 Ч/З КО
| |ЗЫРЯД
'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html