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

A Basic Regex Example In Ruby

06.30.2006
| 6343 views |
  • submit to reddit
        This is a simple regex in ruby. It returns an array of all bbcode urls.

bbcode_urls = text.scan(/\[url={0,1}.*?\].*?\[\/url\]/)