[ create a new paste ] login | about

Link: http://codepad.org/ijzZYMb1    [ raw code | output | fork ]

minitech - Ruby, pasted on Jan 25:
1
2
3
string = 'this_should_not have emphasis but _this_ one should'
string.gsub!(%r{(^|\s)([*_])(.+?)\2(\s|$)}x, %{\\1<em>\\3</em>\\4})
puts string


Output:
1
this_should_not have emphasis but <em>this</em> one should


Create a new paste based on this one


Comments: