You are not logged in.
Pages: 1
ABC = fixed characters
X = variable character ([A-Z])
'' = double '
Last edited by Stamimail (2016-09-06 20:10)
Offline
Have you tried to use: Insert '' at Position 4?
If that is not what you need, then please provide complete examples.
Offline
ABCX is a word within words in Filename.
In list of Filenames, you can find this word in such cases: ABCA, ABCB, ABCC ... ABCZ
I want to add double apostrophe '' in front of the last letter, like that: ABC''X
Offline
This can be achieved with the following RegEx rule:
Replace expression "\b(ABC)([\w])\b" with "$1''$2"
Input:
ABCX is a word within words in Filename.
In list of Filenames, you can find this word in such cases: ABCA, ABCB, ABCC ... ABCZ
I want to add double apostrophe '' in front of the last letter, like that: ABC''X
Output:
ABC''X is a word within words in Filename.
In list of Filenames, you can find this word in such cases: ABC''A, ABC''B, ABC''C ... ABC''Z
I want to add double apostrophe '' in front of the last letter, like that: ABC''X
Offline
Is the RegEx works for only English letters?
How to implement this for non-English letters? (the same example above, just the ABCX are non-English letters)
Offline
RegEx engine does understand Unicode characters which are specified explicitly, but character classes and meta characters such \w and \b currently work only with English character set.
Your task could be achieved with a PascalScript rule, but it will be a bit more complex.
Offline
Your task could be achieved with a PascalScript rule, but it will be a bit more complex.
This is the script that does it, but it will require the next development version of ReNamer (v6.6.0.1 Beta) because it uses newly added functions:
const
QUOTE = '''''';
var
Initialized: Boolean;
ABC: WideString;
Position: Integer;
begin
if not Initialized then
begin
ABC := WideInputBox('ABC', 'Enter your ABC sequence:', '');
Initialized := True;
end;
if Length(ABC) > 0 then
begin
Position := 1;
while Position > 0 do
begin
Position := WideTextPosEx(ABC, FileName, Position);
if Position > 0 then
begin
if Position + Length(ABC) <= Length(FileName) then
if IsWideCharAlpha(FileName[Position + Length(ABC)]) then
if IsWideWordBoundaryLeft(FileName, Position) then
if IsWideWordBoundaryRight(FileName, Position + Length(ABC)) then
begin
WideInsert(QUOTE, FileName, Position + Length(ABC));
Position := Position + Length(QUOTE);
end;
Position := Position + Length(ABC);
end;
end;
end;
end.
Offline
Pages: 1