Hi everyone,
Sorry I'm really bad at regexes, I finally hacked osmething to work in ruby. I'd appreciate if someone can instruct the proper way of how to do this:
I basically wanted to remove all \n when it appears within ul tags.
while body =~ /<ul>.*(\n+).*<\/ul>/m
body =~ /<ul>(.+)<\/ul>/m
body.gsub!(
/<ul>(.+)<\/ul>/m,
"<ul>#{$1.gsub("\n","")}</ul>" )
end
The 2nd line took me forever to figure out, since the $1 was from the while loop, not actually from the gsub statement.
Thanks!