Marco Panichi
Marco Panichi

Reputation: 1185

Remove everything before "http://..." in string

I have a txt with line like these ones:

155The Last Goodnight - Stay Beautiful by CapitolMusic  http://www.youtube.com/watch?v=H5c2iTcSlbE
156Sara Evans - A Real Fine Place To Start by saraevansVEVO http://www.youtube.com/watch?v=IrdCBkXB91I
157Simple Minds - See The Lights by SimpleMindsVEVO http://www.youtube.com/watch?v=MmKTMAak710

I want to remove everything before "http://..." in order to reach this result:

http://www.youtube.com/watch?v=H5c2iTcSlbE
http://www.youtube.com/watch?v=IrdCBkXB91I
http://www.youtube.com/watch?v=MmKTMAak710

Can you help me?

Upvotes: 4

Views: 28998

Answers (2)

arush436
arush436

Reputation: 1806

In Java:

justHttp = justHttp.replaceFirst(".*(?=http://)", "");

For any other use just replace http:// with yourString.

Upvotes: 2

Tim Pietzcker
Tim Pietzcker

Reputation: 336138

.*(?=http://)

matches everything before the last http:// in a line.

Upvotes: 22

Related Questions