L
Logan Capaldo
Is there a way to get a Regexp to tell you if it didn't match because
it won't match with the current input, or if it doesn't match (yet)
but potentially could with more input? Failing that, is there an
alternative regexp library for ruby that will allow that? I ask
becasue I'd like to do something along the lines of:
File.open(some_file) do |f|
f.scan(/a regex/) do |res|
# do something with res
end
end
I realise I could just load the whole file into memory, but that seems
kind of well, icky.
it won't match with the current input, or if it doesn't match (yet)
but potentially could with more input? Failing that, is there an
alternative regexp library for ruby that will allow that? I ask
becasue I'd like to do something along the lines of:
File.open(some_file) do |f|
f.scan(/a regex/) do |res|
# do something with res
end
end
I realise I could just load the whole file into memory, but that seems
kind of well, icky.