Page 1 of 1

Help with regular expressions

Posted: Thu Feb 25, 2010 2:12 pm
by jpirog
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.

Re: Help with regular expressions

Posted: Thu Feb 25, 2010 3:23 pm
by Abacre
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.

Re: Help with regular expressions

Posted: Thu Feb 25, 2010 6:12 pm
by jpirog
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

Re: Help with regular expressions

Posted: Thu Feb 25, 2010 6:27 pm
by Abacre
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.

Re: Help with regular expressions

Posted: Thu Feb 25, 2010 8:15 pm
by jpirog
Thanks :) Works like a charm.