Reputation: 987
I want to replace <br>
or <br/>
tags with /n
(newline).
What is the pattern for this with regex?
Upvotes: 4
Views: 1426
Reputation: 14399
Ruby:
a = "I want to replace <br> or <br/> tags with /n(newline)."
puts a
a.gsub!(%r~<br\s*\/?>~, "\n")
puts a
Upvotes: 7