Thanks Mathias.
I got confused with
$arr - when it was present the script completed one pass, but not the rest of the selection. (As you must realize).
So I left
$arr in order to get the operation to complete & thus find out which part of the regex
would work.
I started using perl type commands but as you say the
StrRegExpReplace function won't allow me to do a 'batch' of separate ops.
Took me a while to see which string was the right one with which to replace $arr. But I now have a better array usage!
This will make changes to multiple selections now (not what I want of course but better from a script point of view.) -
@var $arr = GetSourceSelectedPaths();
@var $items = arrayCount($arr);
@var $CurrentNameFullPath;
@var $OrgName;
@var $re = "\w.";
@var $result;
@var $n = 0;
for( $n = 0; $n < $items; $n++ )
{
$CurrentNameFullPath = $arr[ $n ];
$OrgName = PathGetNamePart( $CurrentNameFullPath );
$result = StrRegExpReplace($OrgName, $re, " ");
RenameFile( $CurrentNameFullPath, $result, "SILENT" );
}
I cannot use ( ) within the
$re define multiple segments, soI think I would have to do a loop of repeat operations to change each element individually. Quite frustrating when I can run the regex's I posted in a text editor on text & get the right result.
Regular Expression Editor (RegExpEditor), amongst others, on sourceforge could be useful for regex types.
Well I guess that is enough headache for one day.
+++
UpdateThought I'd add the regex I was using to change the date field I mentioned above for clarity. (I was showing the whole string as regex transpositions instead of in -> out)
10_May_1989 -> 10 May 1989
find -
((?:[0-9]+)+)_((?:[a-zA-Z]+)+)_((?:[0-9]+)+)
replace -
\1 \2-\3
I think I can see a way for each \#<match> for be given its' own instruction. More headaches req'd.
The main advance for me here is the visualization of matrices in your script. I was thinking more DOS Basic & linear commands. Matrix application is more dynamic of course. So thanks for forcing me down that road.