I am trying to rename 3k notes that were imported from Reflected app with broken names using the Bulk Rename plugin. It is awesome, but i struggle with RegEx. The pattern of names is not the same for the whole set of notes, but the majority of them have the following pattern: ABC p0000 ABC, where 0000 is actually incrementing from 1 to 3999 across the set of notes, so there are only unique numbers after p. So the first note is for example ABC p1 ABC, second is BOB p2 BOB, third is Obsidian p3 Obsidian and so on.
What I need is to cut everything so that the name becomes just ABC
I am not good with RegEx and Claude-2 is writing me complete bullshit instructions - regex he provides either does not work or does not find notes. Maybe I am bad in prompting, too
I’ve searched by RegEx, but no success so far. Please help somebody
From what I’ve seen from your requirement, it should not be so difficult. But there are some caveats. For example, files that may get renamed but should not must be first moved from the directory. Do you know how to take these precautions?
Also, as on StackOverFlow as well (where you can also put up a request), they want clear instructions because we want to make sure we don’t cause harm.
Use code blocks as well when you rewrite instructions: 4-5 instances of filenames that match a pattern and required result in a different block. We need to see clear.
Also, a tip:
If you are on Windows, install voidtools - Everything proggy. Select all files for rename (F2) and you can see when you make regex changes what would change to what before hitting rename. It is very helpful.
Thank you so much for your reply! I am not on Windows.
I think I know how to move files from one directory to another, but if i need to go through my 4 thousand notes to decide which ones should I move and which should stay, I might as well just rename all those 4 thousand notes. Maybe I did not get your idea correctly?
I thought that RegEx would just ignore those notes that have a different pattern in their name? Anyway, let me provide a couple of examples.
I actually have two recurring patterns after the migration.
The first one is exactly like I described above.
The format for examples is following: Note title I currently have >>> Note title I want after RegEx transfornation
The second pattern is a little bit different. Those notes have a name of the note followed by a long sequence of letters and digits that looks like a hash. The format of examples would be the same as for the first pattern.
Ex.1: DNA db60e6524e3a463a8990ec8d1135d870 >>> DNA
Ex. 2: European Union 8bc25ea6eccc4ea19ac2eb58122add14 >>> European Union
Ex.3: equity 370a65f13528475b8b203198fd1d433b >>> equity.
Hope I correctly grasped the idea of clarity, would really appreciate any help, and thanks once again for helping me out!
Are the files already in an Obsidian vault, so that is possible to do some regex fun to check for potentially duplicates? If so, I would strongly suggest doing that before renaming stuff.
And of course do make backups before doing any major changes to your files.
Yes, also, a surefire stringent regex is impossible to do without knowing or having the opportunity of taking in (“seeing”) all variety.
But I have a hunch it is not a matter of life and death here.
It is possible that multiple matches will fight for the same new name (I guess the OS will rename them sequentially then).
Have a look at this, folks:
I did not cater to Scheme 1 because I don’t think these types would come in the large majority.
@svr, you realize more than one search and replace is needed?