Would someone be kind enough to furnish a Regex to be used in a script that will do the following:
For the selected file(s) remove all vowels from the Name but leave the Extension untouched.
Thank you yet again ...
Request for a Regex
-
aliteralmind
- Posts: 261
- Joined: 02 Dec 2014 16:49
Re: Request for a Regex
Code: Select all
$nameExt = "astuhosetuhahcsotetoasuh.abc";
$base = getpathcomponent($nameExt, "base");
$ext = getpathcomponent($nameExt, "ext");
echo RegExReplace($base, "[aeiou]", "").".".$ext;Windows 8.1, 64-bit
-
highend
- Posts: 14946
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Request for a Regex
That's a two step process.
Code: Select all
$list = "";
foreach($file, "<get SelectedItemsPathNames |>") {
$base = regexreplace(getpathcomponent($file, "base"), "[aeiou]");
$ext = getpathcomponent($file, "ext");
$file = "$base.$ext";
$list = $list . $file . "<crlf>";
}
text $list;One of my scripts helped you out? Please donate via Paypal
-
aliteralmind
- Posts: 261
- Joined: 02 Dec 2014 16:49
Re: Request for a Regex
Right. I only supplied the regex, not the "do this for all selected files" part.
Windows 8.1, 64-bit
-
aurumdigitus
- Posts: 1075
- Joined: 30 May 2008 21:02
- Location: Lake Erie
Re: Request for a Regex
Copious thank you's everyone. The code is exactly what was needed and it came so quickly!
Scoping out the reference to stackoverflow it looks very promising. The time may have finally come to "get my feet wet" in the pool of Regex.
Scoping out the reference to stackoverflow it looks very promising. The time may have finally come to "get my feet wet" in the pool of Regex.
-
Filehero
- Posts: 2731
- Joined: 27 Feb 2012 18:50
- Location: Windows 11@100%
Re: Request for a Regex
Saves me a question. Cool, that the maintainer actually is really you.aliteralmind wrote:And check out the Stack Overflow Regular Expressions FAQ, which I maintain.
Cheers, FH
-
aliteralmind
- Posts: 261
- Joined: 02 Dec 2014 16:49
Re: Request for a Regex
Windows 8.1, 64-bit
-
Marco
- Posts: 2354
- Joined: 27 Jun 2011 15:20
Re: Request for a Regex
A little addendum: you may want to perform a recase("string", "removediacritics") first, otherwise vowels like à or é won't be removed.
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]
XYplorer Beta Club