Page 1 of 1

[Solved]Scripting help : regular expression replace string

Posted: 28 Oct 2015 01:54
by xnmp
solved i use regexreplace

Code: Select all

$curItem = "<curitem>";
    open (regexreplace(property("#Comment"),"[ \t]*[¶][ \t]*",""));

Thanks
i have files that store another file's full path in comment (the comment only contains filepath)
i want to write a script that retrieve the filepath in the comment of selected file ,then open it (open the file that path stored in comment, not the selected file
For example :
i have a file s.jpg ,the comment of s.jpg is "e:\documents\file.docx"
i want to open "e:\documents\file.docx" when selected "s.jpg"

so i wrote that code

Code: Select all

    
 $curItem = "<curitem>";
    open property("#Comment");
It works but if the comment contains special characters like space, return characters (\r\n in regular expression) it won't work

Re: [Solved]Scripting help : regular expression replace stri

Posted: 28 Oct 2015 06:52
by highend
Btw, open is just a simple command with no parentheses :)

Code: Select all

open regexreplace(property("#Comment"),"[ \t]*[¶][ \t]*");

Re: [Solved]Scripting help : regular expression replace stri

Posted: 28 Oct 2015 09:22
by xnmp
@highend : Thanks so much