I am finding this sort-of GREP mini tutorial very helpful in sorting out the mess Lightroom makes in exporting keywords. For example, I keep my keyword categories in square brackets. I do not want to have them in my flat keywords and I can get rid of them in images exported from LR using Find and Replace, searching for \[(.*?)\] and replacing it with a blank. So far, so good.
What I cannot get rid of though is the separator, whether as a result of adding hierarchical keywords through Lightroom or the use of the Metadata (IPTC) Template. In Kirk's examples above, the code is [ \¦], but I have had to type the vertical pipe in, because copying and pasting, here and in RegExr and in the Find and Replace panel, comes out as a comma, as in [ \,]. Using the comma, with or without spaces either side, does not work. Using the pipe symbol typed in replaces all the spaces between words, not the separators. I have also tried using the unicode number u007c, but to no avail. I have made sure that IPTC data is set to unicode.
I know this is not a GREP help forum, but I have not been able to find the answer, trying to create an addition to \[(.*?)\] which will also remove the vertical separators (and not delete other non-alphabetic characters such as hyphens in my keywords). Is this because I am on Windows 10, not a Mac? Clearly it worked for Paulo.
If I can sort this out, it makes deleting all duplicate flat keywords after export from Lightroom developing much easier. My next ambition is them to do the opposite, which is to strip out flat keywords for images I want in Lightroom. I think that, however, there is going to be a fundamental problem with this round tripping, even preserving separators, in that although both Photo Mechanic and Lightroom recognise synonyms, and display them accordingly, EXIF does not and so far as EXIF is concerned they are all just keywords. This seems to mean that if there is a new word which is a keyword in one and and a already a synonym in the other, of a duplicate keyword in the destination application, it does not know where to put this, so LR treats it as a flat keyword even though it should be hierarchical. I don't know whether I have explained this very well, but whatever I have done over many months trying to get keywords to round trip between PM to LR and back seems to fall over if the same word appears in more than one location in the vocabulary/library, particularly if you think you are adding a new keyword in PM: if it exists in a different location in LR or with different synonyms, LR refuses to see it as other than a new flat keyword or (even worse) a new partial hierarchy hidden within part of its existing hierarchy, causing horrendous duplication. I am hoping I can use GREP to sort out some of the messes that LR makes, and to take out the flat keywords where I try to send a file keyworded in PM to LR after syncing the keyword vocabularies.
Any help/thoughts on the GREP issue would be much appreciated.
Graham