(In my gut think I may have requested this many iterations of XY ago but now am unable to find the code.
Request help from a scriptor
-
aurumdigitus
- Posts: 1075
- Joined: 30 May 2008 21:02
- Location: Lake Erie
Request help from a scriptor
Want to use Rename Special with a RegExp. Expression one would remove the first X characters of a file name(s). Expression two would remove the last X characters from the file(s) name.
(In my gut think I may have requested this many iterations of XY ago but now am unable to find the code.
)
(In my gut think I may have requested this many iterations of XY ago but now am unable to find the code.
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: Request help from a scriptor
I'm not sure if this old script I posted actually still works but it could handle those two cases when it did: http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=2316
Either way the regex patterns in it should still be good, though it's possible they could be improved (I've learned a bit since then).
In simplest terms...
This will remove 2 characters from the beginning.Similarly, this will remove 3 from the end of the full filename.But you probably want to remove them from the base name before the extension so you'd want something like
Either way the regex patterns in it should still be good, though it's possible they could be improved (I've learned a bit since then).
In simplest terms...
This will remove 2 characters from the beginning.
Code: Select all
^.{2} > Code: Select all
.{3}$ > Code: Select all
.{3}(\.[^.]+$) > $1-
highend
- Posts: 14953
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Request help from a scriptor
1.
2.
X = the max number of chars to remove
Code: Select all
^\w{X} > Code: Select all
\w{X}(\.[^.]+$) > $1One of my scripts helped you out? Please donate via Paypal
-
aurumdigitus
- Posts: 1075
- Joined: 30 May 2008 21:02
- Location: Lake Erie
Re: Request help from a scriptor
Thanks everyone!
Some time before the sun runs out of hydrogen I try to sit down and learn this RegExp business.
Some time before the sun runs out of hydrogen I try to sit down and learn this RegExp business.
XYplorer Beta Club