Ruby gsub for Wild Card Search

Hi,

I am very new to Ruby.

I have a script to remove unwanted text from Spiceworks (Ticketing
system).

For that, I need to do a wild card search on a string and replace a
particular text block.

Text block is as below

[Description: Description: Description: Description: Description:
Description: Description: Description: Description: Description:
Description: D:\Users\Documents\My Received
Files\horiz_RGB_Email_Signature_Transparent_400px.png]
[cid:image002[email protected]]http://www.facebook.com/MusicAU[cid:[email protected]]http://instagram.com/music[cid:[email protected]]https://twitter.com/Music[cid:[email protected]]http://www.youtube.com/user/Music

However in the above block [email protected] can change on every
ticket. So I have to use wild card to replace it.

Not sure how to do wildcard search in the whole text.
Start: [Description:
End: http://www.youtube.com/user/Music

I am using following which only replaces first [Description.
db_text = db_text.gsub("[Description: Description: Description:
Description: Description: Description: Description: Description:
Description: Description: Description:","")

Not sure where and what to put for wild card search.

Please help me.

On Wed, Feb 26, 2014 at 2:18 AM, Chirag J. [email protected]
wrote:

However in the above block [email protected] can change on every

Not sure where and what to put for wild card search.

What is it exactly that you want to replace? Can you show from the
example text above, what would be your required output? And also, in
other texts that you will process, what will vary from one to another,
only what is after the @?

Jesus.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs