Forum: Ruby Ruby gsub for Wild Card Search

4445b3e411dab0890d856ebcad84a595?d=identicon&s=25 Chirag Jhaveri (jchirag0221)
on 2014-02-26 02:18
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.png@01CF32E4.E5D83D80]<http://www.facebook.com/MusicAU>[cid:image003.png@...

However in the above block .png@XXXXXX.XXXXXX 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.
E088bb5c80fd3c4fd02c2020cdacbaf0?d=identicon&s=25 Jesús Gabriel y Galán (Guest)
on 2014-02-26 09:15
(Received via mailing list)
On Wed, Feb 26, 2014 at 2:18 AM, Chirag Jhaveri <lists@ruby-forum.com>
wrote:
>
> However in the above block .png@XXXXXX.XXXXXX 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.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.