Created
March 1, 2009 00:04
-
-
Save nitsujw/72154 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## If the matched image has a "?" as part of the source the gsub fails | |
## http://example.net/test.jpg <-- Does get gsub'd | |
## http://example.net/test.jpg?624332 Doesn't get gsub'd | |
imgs = self.body_html.scan(/\[img\](.*?)\[\/img\]/i) | |
imgs.each do |img| | |
body_html.gsub!(/\[img\]#{img[0]}\[\/img\]/i, "<img src=\"#{img[0]}\" />") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment