如何匹配字符串直到文本文件的结尾?

时间:2022-02-10 19:23:07

In this line of code I want it to match the string from 'Review Notes \50optional\51' till the end of the text file. How can I do this?

在这行代码中,我希望它匹配“Review Notes \ 50optional \ 51”中的字符串,直到文本文件的末尾。我怎样才能做到这一点?

reviewNotes = contents.match(/Review Notes \50optional\51\n==================(.*?)/m)[1].strip

2 个解决方案

#1


1  

Review Notes \50optional\51.*$

#2


1  

if subject =~ /Review Notes \\50optional\\51.*\z/m
    match = $&
else
    match = ""
end

#1


1  

Review Notes \50optional\51.*$

#2


1  

if subject =~ /Review Notes \\50optional\\51.*\z/m
    match = $&
else
    match = ""
end