I have a bunch of files with number/letter combinations in the file names.
I would like to change a letter that appears after a number, but NOT every instance of that letter in the filename.
So I want to search for "Any Number" and then that letter, and replace it with THAT NUMBER and the new letter.
I'm sure it's easy, and in the Help, and posted elsewhere... I just ain't finding it.
Thanks!
Examples:
2002E Lorem Ipsum
2003E Dolor Sit
2003E Amet Consectetuer
2004E Adipiscing Elit
2004E Maecenas
to:
2002P Lorem Ipsum
2003P Dolor Sit
2003P Amet Consectetuer
2004P Adipiscing Elit
2004P Maecenas
So I searched for all instances of Capital E that came after any number and replaced only the E with a P. I did not replace all instances of E, and I did not replace any numbers.
MRN Search/Replace Wild(ish) Cards
Moderators: Hacker, petermad, Stefan2, white
-
- Junior Member
- Posts: 77
- Joined: 2018-03-28, 20:13 UTC
MRN Search/Replace Wild(ish) Cards
Dan: You're gonna need to get someone to fix my computer.
Kim: What's wrong with it?
Dan: It's in several pieces on my floor.
Kim: What's wrong with it?
Dan: It's in several pieces on my floor.
Re: MRN Search/Replace Wild(ish) Cards
Code: Select all
Search for: (\d+)E
Replace with: $1P
☑ RegEx
-
- Junior Member
- Posts: 77
- Joined: 2018-03-28, 20:13 UTC
Re: MRN Search/Replace Wild(ish) Cards
Perfect. Thanks. To understand:
(\d+)E searches for all numbers that are followed by the capital E.
(If I leave Replace "Clear", that would remove "2002E", for example).
$1P means that once it finds that string, it should only replace the next character. If I had done $2, it would have replaced two characters, etc.
Yes?
What if, for example, I wanted to replace just the last digit?
So 2002E => 200xE, 2003E => 200xE, etc.
Playing around and can't quite figure it out.
(\d+)E searches for all numbers that are followed by the capital E.
(If I leave Replace "Clear", that would remove "2002E", for example).
$1P means that once it finds that string, it should only replace the next character. If I had done $2, it would have replaced two characters, etc.
Yes?
What if, for example, I wanted to replace just the last digit?
So 2002E => 200xE, 2003E => 200xE, etc.
Playing around and can't quite figure it out.
Dan: You're gonna need to get someone to fix my computer.
Kim: What's wrong with it?
Dan: It's in several pieces on my floor.
Kim: What's wrong with it?
Dan: It's in several pieces on my floor.
Re: MRN Search/Replace Wild(ish) Cards
No. And instead of playing around, may I suggest to read the help first?Alonzo Mosley wrote: 2024-11-01, 17:26 UTC Perfect. Thanks. To understand:
..
$1P means that once it finds that string, it should only replace the next character. If I had done $2, it would have replaced two characters, etc.
Yes?
..
Playing around and can't quite figure it out.

Help wrote:Subexpressions for search+replace
Text parts in round brackets are taken as subexpressions. Up to 89 subexpressions are supported now.
Example: To swap the title and interpret in the file name of an mp3 file, when they are separated by a dash (Title - Interpret.mp3), use the following options:
Search for: (.*) - (.*)\.mp3
Replace by: $2 - $1.mp3
Here $1 means the text in the first round bracket, and $2 the text in the second round bracket.
In "Replace by", use parameters \U, \L, and \F to convert the placeholder text behind it to uppercase, lowercase, or first char in word uppercase, e.g.
Search for: (.*) - (.*)\.mp3
Replace by: \U$2 - \L$1.mp3