Hi Victoria,
Here is a possible two pass solution:
First:
A Case sensitive Find / Replace :
(?<=href=")([^#]+)#[^_]+_([A-Z][a-z]+)([A-Z][a-z]+)?([A-Z][a-z]+)?([A-Z][a-z]+)?([A-Z][a-z]+)?([A-Z][a-z]+)?([A-Z][a-z]+)?([A-Z][a-z]+)?([A-Z][a-z]+)?([A-Z][a-z]+)?(?=")
Replacement:
\1#\L\2-\3-\4-\5-\6-\7-\8-\9-\10-\11
That will give you:
<a
href="/premium-classic/before-you-start.xhtml#installing-lightroom--------">Installing
Lightroom</a>
<a
href="/premium-classic/before-you-start.xhtml#multiple-computers--------">Multiple
Computers</a>
<a
href="/premium-classic/before-you-start.xhtml#keeping-lightroom-updated-------">Keeping
Lightroom Updated</a>
<a
href="/premium-classic/managing-your-photos.xhtml#managing-folders-in-lightroom-and-on-the-hard-drive-">Managing
Folders in Lightroom and on the Hard Drive</a>
<a
href="/premium-classic/managing-your-photos.xhtml#changing-the-folder-structure------">Changing
the Folder Structure</a>
Second:
Find / Replace:
-+(?=">)
Let the replacement be empty:
That should work up to 10 terms camelCased query fragments.
HTH
Jean Jourdain
On Friday, January 26, 2024 at 4:01:09 PM UTC+1 MediaMouth wrote:
> The grep experts here are always impressive. If they can't get it done
> with regex, a JS solution can.
>
> On Jan 26, 2024, at 05:49, Victoria Bampton <[email protected]>
> wrote:
>
> There's clearly lots of experience here... can anyone tell me if this is
> possible to do a find/replace GREP?
>
>
> Links like those following are spread throughout a series of documents. I
> need to change the bit after the hash (e.g., #sub_InstallingLightroom) to
> remove the chunk before the underscore, put a hyphen before each uppercase
> character, and change the uppercase to lowercase (e.g., it becomes
> #installing-lightroom). That could be multiple finds/replacements, as I can
> deal with some of it, but I'm getting stuck on targeting and transforming
> those uppercase characters. Is it doable? Any bright ideas would be greatly
> appreciated!
>
> <a
> href="/premium-classic/before-you-start.xhtml#sub_InstallingLightroom">Installing
>
> Lightroom</a>
> <a
> href="/premium-classic/before-you-start.xhtml#box_MultipleComputers">Multiple
> Computers</a>
> <a
> href="/premium-classic/before-you-start.xhtml#sub_KeepingLightroomUpdated">Keeping
>
> Lightroom Updated</a>
> <a
> href="/premium-classic/managing-your-photos.xhtml#sub_ManagingFoldersInLightroomAndOnTheHardDrive">Managing
>
> Folders in Lightroom and on the Hard Drive</a>
> <a
> href="/premium-classic/managing-your-photos.xhtml#sub_ChangingTheFolderStructure">Changing
>
> the Folder Structure</a>
>
> --
> This is the BBEdit Talk public discussion group. If you have a feature
> request or need technical support, please email "[email protected]"
> rather than posting here. Follow @bbedit on Twitter: <
> https://twitter.com/bbedit>
> ---
> You received this message because you are subscribed to the Google Groups
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/f3743619-5c95-4161-8107-b81affbdd6dan%40googlegroups.com
>
> <https://groups.google.com/d/msgid/bbedit/f3743619-5c95-4161-8107-b81affbdd6dan%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
--
This is the BBEdit Talk public discussion group. If you have a feature request
or need technical support, please email "[email protected]" rather than
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/67518cb6-6957-4837-840f-71298b02d5f6n%40googlegroups.com.