通过以下用途gsub
,我希望"No, but I heard it's short and soft."
将其放在块引号之间。第一次,它是空的。当我立即再次运行它时,它做对了。
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"
有什么想法吗?