Hi again.
How do I regex a filename so the files themselves are erased leaving paths only behind, with trailing '\'s? TIA!
As a general rule, the rightmost element of the last '\' can be considered as a file, even if it's lacking any extension or it's actually a folder.
Inputs:
c:\my\path\file.exe
d\another\random\path\_item
Outputs:
c:\my\path\
d\another\random\path\
EditPad regex Help
-
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
EditPad regex Help
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Re: EditPad regex Help
Code: Select all
^.*\\(?=.*?$)
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]
Don sees all [cit. from viewtopic.php?p=124094#p124094]
-
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: EditPad regex Help
Hi, Marco, thanks for popping out.
It's producing the opposite, ie, taking out the paths, leaving the files behind.
Tried
just to have some random mess.
In a variant task, I'd need to have just the parent folders as outputs. Please?
Inputs:
c:\my\path\file.exe
d\another\random\another path\_item
Outputs:
path
another path
Regards - and congrats for the awesome Archive!
It's producing the opposite, ie, taking out the paths, leaving the files behind.
Tried
Code: Select all
(^.*\\)?=.*?$
In a variant task, I'd need to have just the parent folders as outputs. Please?
Inputs:
c:\my\path\file.exe
d\another\random\another path\_item
Outputs:
path
another path
Regards - and congrats for the awesome Archive!
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Re: EditPad regex Help
So you don't want to match the paths, you want to replace with nothing (aka remove) the files? Subtle difference ... With the regex I gave you then you could click on "Copy matches" to have those paths. If you want to zap instead the filenames, then use thisSkyFrontier wrote: It's producing the opposite, ie, taking out the paths, leaving the files behind.
Code: Select all
[^\\]*?$
For the other task, use this
Code: Select all
(?<=^.*\\)[^\\]+?(?=\\[^\\]+?$)
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]
Don sees all [cit. from viewtopic.php?p=124094#p124094]
-
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: EditPad regex Help
Hi, Marco. First task done.
But again - the other code is matching parent folders, thus replacing them by nothing; I need the other way round!
See...?
...or is it something I should change in replacement GUI I am missing...?
But again - the other code is matching parent folders, thus replacing them by nothing; I need the other way round!
See...?
Code: Select all
Inputs:
c:\my\path\file.exe
d\another\random\another path\_item
Outputs:
path
another path
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Re: EditPad regex Help
I told you that that regex matches the parent folders! I don't understand, if you need the parent folders, why you insist on deleting the rest? Copy the matches!
- Attachments
-
- Appunti-20180930-01.png (157.52 KiB) Viewed 6309 times
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]
Don sees all [cit. from viewtopic.php?p=124094#p124094]
-
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: EditPad regex Help
...didn't know I could do it that way, sorry...
Old dog got a new trick, thanks!
Old dog got a new trick, thanks!
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
-
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: EditPad regex Help
Downside of this method: way too slow compared to the regular '-del-right-on-the-document', when exporting to the clipboard from a 200 MB source file.
...waaaaaaaay too slow.
...waaaaaaaay too slow.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...