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?
asked Feb 15, 2013 at 11:05
Marco Panichi
1,1951 gold badge20 silver badges32 bronze badges
-
I can't try anything reasonable, becouse I'm new to reg exp. I've tryed to use reg exp builder as gskinner, expresso and regexpbuddy. Simply I can't understand how to start. I've tried an 1 hour before posting here (I know there are lots of know-all ready to put -1)Marco Panichi– Marco Panichi2013年02月15日 11:12:33 +00:00Commented Feb 15, 2013 at 11:12
-
I get the frustration. Regex is not something that you can reference on a need to know basis, and a cheatsheet is of no use if you have never sat down and practised it, but many regex tutorials treat it as such/ assume too much. Waste of an hour!Wil– Wil2013年08月26日 08:19:10 +00:00Commented Aug 26, 2013 at 8:19
2 Answers 2
.*(?=http://)
matches everything before the last http:// in a line.
answered Feb 15, 2013 at 11:07
Tim Pietzcker
338k59 gold badges521 silver badges572 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
Tim Pietzcker
@user128806: Yes, just use
.*? instead of .*.In Java:
justHttp = justHttp.replaceFirst(".*(?=http://)", "");
For any other use just replace http:// with yourString.
answered Oct 22, 2015 at 15:51
arush436
1,81621 silver badges21 bronze badges