Posted By

inko9nito on 01/03/11


Tagged

regex textile replace ruby tags match asterisk


Versions (?)

Match text between asterisks


 / Published in: Regular Expression
 

URL: http://rubular.com/r/73UNIqgDuO

Matches text between each pair of asterisks (see URL above for demo)

Example:

Make text between asterisks bold, like in Textile (in Ruby):

test.gsub(/(\*)+([^.*?$]+)+(\*)/, '<strong>\\2</strong>')

  1. (\*)+([^.*?$]+)+(\*)

Report this snippet  

You need to login to post a comment.