DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Quote-delineated Tag Sets

  • submit to reddit
        snippet to surround a tag with “smart quotes” if it contains any odd characters. i.e. to display tags entered in a flickr-like style (space separated except inside quotes)

tag.gsub(/^/,'“').gsub(/$/,'”') if tag[0].match(/[^A-Za-z0-9\-_.]/)