Regexp help

Hi, i need help about regexp...

i want delete "I.",
leave the next 10 characters,
replace "000_" by "-",
leave the next 1 or 2 letters (1),
replace "0." by "-",
and leave the next 2 numbers (2).

First : is there an expression for replace my (..........) to leave 10 characters
Second : is there a way to leave more than 1 characters for (1) and (2)

Thanks

Add a + after both the [a-z] and the [0-9]

That will make them match one or more letters/numbers.

If you want them to match exactly one or two (but no more) letters/numbers then you could use this (at least in theory; I haven't tested any of these):

([a-z]|[a-z][a-z])

([0-9]|[0-9][0-9])

Or:

a-z

0-9

Thanks Nudel, it's perfect...

can you explain to me this...

[quote]When using regular expressions with the Rename command, you can append a # symbol to the end of the “old
name” pattern to signify that you want the pattern to be repeated. This lets you effectively turn regular expression
into a “find and replace” system. You can also specify a maximum number of repetitions by following the # with a
number, for example:
(.) - (.)#5[/quote]

Normally a regular expression find & replace is only applied once. Using the # lets you make it recursive.

In other words, after it is applied the first time to get a new filename it is then applied again to that result, and again and again until the filename stops changing (or until the specified number of repetitions is reached).

For example, create a new text file and call it

a1a2a3a4a5a6a7a8a9a.txt

Then go into the Rename dialog with that file selected and set the Type to Regular Expressions.

If you set the old name to ba(.)[/b] and the new name to \1\2 then you will remove just one of the 'a' characters from the filename. Opus could choose to remove any one of the 'a' characters but seems to consistently pick the last one (because the first (.) is "greedy" and will try to match as many characters as possible):

a1a2a3a4a5a6a7a8a9.txt

If you put a # on the end of the old name, so that it is ba(.*)#[/b] then all of the 'a' characters will be removed:

123456789.txt

If you instead put #3 on the end, so it's ba(.*)#3[/b] then three 'a' characters will be removed, because Opus will apply the expression three times:

a1a2a3a4a5a6a789.txt

Oh yes, many thanks. i understand now...

Now i try to add this in a script but don't work...

[code]@script vbscript
option explicit

Function Rename_GetNewName ( strFileName, strFullPath, fIsFolder, strOldName, ByRef strNewName )
Dim re, strExtension, strNameOnly
Set re = new RegExp
re.IgnoreCase = False
re.Global = True

if fIsFolder or 0 = InStr(strFileName,".") then
strExtension = ""
strNameOnly = strFileName
else
strExtension = Right(strFileName, Len(strFileName)-(InStrRev(strFileName,".")-1))
strNameOnly = Left(strFileName, InStrRev(strFileName,".")-1)
end if

re.Pattern = "I.(.+)000_([a-z]+)0.([0-9]+)"
strNameOnly = re.Replace(strNameOnly, "$1-$2-F$3")

strNewName = strNameOnly & strExtension

End Function
[/code]

what's happen ?

Try [a-zA-Z] or just [A-Z] instead of [a-z]. Regular expressions tend to be case sensitive and your filenames have uppercase letters while your expression is only looking for lowercase ones.