[Solved]Scripting help : regular expression replace string

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
xnmp
Posts: 88
Joined: 15 Mar 2013 04:46

[Solved]Scripting help : regular expression replace string

Post 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

highend
Posts: 15016
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

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

Post by highend »

Btw, open is just a simple command with no parentheses :)

Code: Select all

open regexreplace(property("#Comment"),"[ \t]*[¶][ \t]*");
One of my scripts helped you out? Please donate via Paypal

xnmp
Posts: 88
Joined: 15 Mar 2013 04:46

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

Post by xnmp »

@highend : Thanks so much

Post Reply