以下用途gsub
,我預計"No, but I heard it's short and soft."
被放置在塊引號之間。第一次,它是空的。當我立即再次運行它時,它是正確的。Gsub第一次失敗,下一步工作?
clean_content = "[quote="PDrizzle":1g581fap]No, but I heard it's short and soft.[/quote:1g581fap]\r\n\r\nwith very few ascents\r\n\r\nheh"
clean_content.gsub(
/\[quote(?:.*)\](.*?)\[\/quote(?:.*)\]/,
"<blockquote>#{$1}</blockquote>"
)
# => "<blockquote></blockquote>\r\n\r\nwith very few ascents\r\n\r\nheh"
clean_content.gsub(
/\[quote(?:.*)\](.*?)\[\/quote(?:.*)\]/,
"<blockquote>#{$1}</blockquote>"
)
# => "<blockquote>No, but I heard it's short and soft.</blockquote>\r\n\r\nwith very few ascents\r\n\r\nheh"
任何想法是怎麼回事?