Help with regular expressions

General discussions about Advanced Find and Replace
Post Reply
jpirog
Posts: 3
Joined: Thu Feb 25, 2010 2:09 pm

Help with regular expressions

Post by jpirog » Thu Feb 25, 2010 2:12 pm

I have a bunch of files name MOV***.mpg.flv where *** is random letters/numbers. I have a text file with each file name on a separate line. I want to search for each file name and replace that with

<a href="Michigan/MOV***.flv">

<strong>MOV***.flv</strong>
</a>

I got it to recognize the MOV***.flv part but I can't get it to replace it with what I want.
I used MOV.*\.mpg\.flv to find the string but now I need to replace what it found with the above..

Anyone help?

Thanks a lot.

Abacre
Site Admin
Posts: 1201
Joined: Mon Jan 31, 2005 5:32 pm
Contact:

Re: Help with regular expressions

Post by Abacre » Thu Feb 25, 2010 3:23 pm

Do you have to rename file names?
Do you you want to replace it in your text file?

I suppose that you have one text file with file names in it
and you want to replace all file names in it with your text including HTML tags.

So please explain what do you need?
Give us sample text file and resulting file as it should be.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

jpirog
Posts: 3
Joined: Thu Feb 25, 2010 2:09 pm

Re: Help with regular expressions

Post by jpirog » Thu Feb 25, 2010 6:12 pm

I don't want to rename any of the files actually. See below for the file names.

I want to add this:

Code: Select all

<a href="Michigan/MOV***.flv">

<strong>MOV***.flv</strong>
</a>
and it would look like this for example:

Code: Select all

<a href="Michigan/MOV0F5.flv">

<strong>MOV0F5.flv</strong>
</a>
to all of the files. So where it says MOV***.flv is the file name from the list below. Does that explanation help anymore?

Code: Select all

MOV0F5.flv
MOV0F8.flv
MOV0FB.flv
MOV0FE.flv
MOV101.flv
MOV104.flv

Abacre
Site Admin
Posts: 1201
Joined: Mon Jan 31, 2005 5:32 pm
Contact:

Re: Help with regular expressions

Post by Abacre » Thu Feb 25, 2010 6:27 pm

Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
MOV.*\.flv
Replace with:
<a href="Michigan/$0">\r\n\r\n<strong>$0</strong>\r\n</a>
That's all I verified it works perfectly.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

jpirog
Posts: 3
Joined: Thu Feb 25, 2010 2:09 pm

Re: Help with regular expressions

Post by jpirog » Thu Feb 25, 2010 8:15 pm

Thanks :) Works like a charm.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest