Deleting all after .MP3 till the end of line ?

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Pedro

Deleting all after .MP3 till the end of line ?

Post by Pedro »

I have a problem,

I want to get rid of everything after .MP3 till the end of the line, like this :

So that....

!DiSCo Dream Dance 15 - CD 2 - 01. Beam & Yanou - Rainbow Of Mine.mp3          ::INFO:: 3.5MB
!DiSCo Dream Dance 15 - CD 2 - 02. Why Does My Heart Feel So Bad.mp3    ::INFO:: 6.2MB
!DiSCo Dream Dance 15 - CD 2 - 03. Rainmaker - Secrets Of Asia.mp3             ::INFO:: 3.0MB
!DiSCo Dream Dance 15 - CD 2 - 04. Liquid Love - Sweet Harmony.mp3             ::INFO:: 6.5MB


becomes....

!DiSCo Dream Dance 15 - CD 2 - 01. Beam & Yanou - Rainbow Of Mine.mp3
!DiSCo Dream Dance 15 - CD 2 - 02. Why Does My Heart Feel So Bad.mp3
!DiSCo Dream Dance 15 - CD 2 - 03. Rainmaker - Secrets Of Asia.mp3
!DiSCo Dream Dance 15 - CD 2 - 04. Liquid Love - Sweet Harmony.mp3


Please can someone help me with this please, I am so confussed using regular expressions and I've tried everything that's in the help file, but it allways end up totally different then I expected. If you can help me, can you do it step by step please ?

Thanks a lot in advance !!
Andreas

Re: Deleting all after .MP3 till the end of line ?

Post by Andreas »

Replace
mp3.*
with
mp3

Make sure Regular expression is checked

. finds any character
* says: find any amount of whatever is before me,
so
.* finds any amount of any characters
Pedro

Re: Deleting all after .MP3 till the end of line ?

Post by Pedro »

Thank you very much Andreas, I don't now how it missed this one :-)

Just another question, how do i look for a point in a text then,

f.e. Just like in the prev. example, now i wan't to delete everything after MP3..

In other words the dot get's seen as a command, but how do i want to make it seen as some part of a string ?
Roy Beatty

Re: Deleting all after .MP3 till the end of line ?

Post by Roy Beatty »

> In other words the dot get's seen as a command, <br>
> but how do i want to make it seen as some part of a string ?

For regex to use "." as a literal, use "\."<br>
In general, if a character is used in regex syntax, preceding it with a \ will make regex see the following character as a literal. There are exceptions to the rule, especially with replacement expressions.

See the TextPad help file and Jeff Epstein's nice regex explanations and resources: http://www.jeffyjeffy.com/textpad/docum ... n_faq.html

Good luck,

Roy
Pedro

Re: Deleting all after .MP3 till the end of line ?

Post by Pedro »

Thanks a lot Roy !
Post Reply