The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Surrounding text with a tag using Ruby’s gsub

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Matthew Bass

Posts: 468
Nickname: pelargir
Registered: Dec, 2005

Jared Richardson and Matthew Bass are independent software consultants
Surrounding text with a tag using Ruby’s gsub Posted: Oct 29, 2008 3:00 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Matthew Bass.
Original Post: Surrounding text with a tag using Ruby’s gsub
Feed Title: Pelargir
Feed URL: http://feeds.feedburner.com/pelargir/
Feed Description: Musings on software and life from Matthew Bass. Regular posts on new web products, tips and tricks, etc.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Matthew Bass
Latest Posts From Pelargir

Advertisement
Here’s how to identify a keyword in a block of text using a case-insensitive regular expression, and surround that keyword with an HTML tag: text = "hello world, this is a test" text.gsub!(/(WORLD)/i, "<b>\1</b>") The following string is produced: hello <b>world</b>, this is a test Note that \\1 references the group in the regex (surrounded by parens). This results in [...]

Read: Surrounding text with a tag using Ruby’s gsub

Topic: Deploying trunk or tags with capistrano Previous Topic   Next Topic Topic: ???

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use