fork download
  1. input = "[twitter:jpunt]"
  2. output = input.gsub(/\[([^:]+):([^\]]+)\]/) {
  3. '<a href="http://' + $1 + '.com/' + $2 + '">@' + $2.capitalize + '</a>' }
  4.  
  5. puts output
Success #stdin #stdout 0s 4760KB
stdin
Standard input is empty
stdout
<a href="http://t...content-available-to-author-only...r.com/jpunt">@Jpunt</a>