Stuck indoor I thought I would try to learn XYplorers script language and perhaps some regex. Just for something to do. My first attemps worked OK but then I wanted to rename a ebook file with a name like
FILENAME (epub).epub
I can remove the epub inside he brackets but how do I remove the string (epub) including the brackets
rename s, "(epub)/";
Does not work. I assume that the brackets are characters that have a special meaning in the script language. I cannot fine this info anywhere.
AQ
How to replace ( and ) in a script?
Re: How to replace ( and ) in a script?
Mh, it should work. It doesn't even in a fresh instance?
There are special chars, like "[" (a range) that in some cases need to be escaped but parenthesis aren't normally of that type
This one would remove all surrounding spaces as well...
There are special chars, like "[" (a range) that in some cases need to be escaped but parenthesis aren't normally of that type
This one would remove all surrounding spaces as well...
rename r, " *\(epub\) * > ";
One of my scripts helped you out? Please donate via Paypal
-
- Posts: 3358
- Joined: 07 May 2007 18:14
- Location: NJ/NY
Re: How to replace ( and ) in a script?
Hello,
That exact script (rename s, "(epub)/") seems to be working for me when I try it from menu Scripting | Run Script. Where exactly are you trying it from?
That exact script (rename s, "(epub)/") seems to be working for me when I try it from menu Scripting | Run Script. Where exactly are you trying it from?
-
- Posts: 21
- Joined: 08 May 2013 23:44
Re: How to replace ( and ) in a script?
Thank you for the quick replies.
Both of your suggestions work OK as does the original one I written. I had closed the PC down and had to reopen it to try these. That may have cleared something out of the system. Computers - will they ever catch on?
I will continue working my way through the script language help file to see what else I can do with them. I find that is the best way for me to learn.
I will start be working out how
rename r, " *\(epub\) * > ";
workd. I may be back with some more questions though.
AQ
Both of your suggestions work OK as does the original one I written. I had closed the PC down and had to reopen it to try these. That may have cleared something out of the system. Computers - will they ever catch on?
I will continue working my way through the script language help file to see what else I can do with them. I find that is the best way for me to learn.
I will start be working out how
rename r, " *\(epub\) * > ";
workd. I may be back with some more questions though.
AQ
Re: How to replace ( and ) in a script?
Please, if you post any code, embed it in code or inline code tags. Far easier to read. The little toolbar above the editor window contains both of them
One of my scripts helped you out? Please donate via Paypal