re = /SRR([0-9]+)([\.])([0-9]+)([\s]+)([A-Z]+)/m
str = ' sequence_id cdr3_aa
0 SRR11610498.829751 AKDLGPDAGYTVFNDYFDN
1 SRR11610498.853725 AKDLGPDAGYTVFNDYFDN
2 SRR11610498.856922 AKDLGPDAGYTVFNHYFDN
3 SRR11610498.861591 AKDLGPDAGYTVFNDYFDN
4 SRR11610498.909314 AKDLGPDAGYTVFNDYFDN
5 SRR11610498.915768 AKDLGPDAGYTVFNDYFDN
6 SRR11610498.922245 ARGGLVVVDSFDY
7 SRR11610498.1017490 ASDLSYASSWLHYFDV
8 SRR11610498.1022079 ARLRFDNGALYFDY
9 SRR11610498.1037667 ASSAPPSGFNWFDP
10 SRR11610498.1111232 AKGPQIVATTTDNLEV
11 SRR11610498.1183596 AKDLGPDAGYTVFNDYFDN
'
# 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