Remove " (*)" unless " (Edited)"

A swapping-ground for Regular Expression syntax

Remove " (*)" unless " (Edited)"

Postby Xii-Nyth » Sun Apr 16, 2023 2:07 am

Hello, I need to do exactly this:
viewtopic.php?t=2542

wiht the exception that nothing happens if the test withing the () is "Edited"
Xii-Nyth
 
Posts: 4
Joined: Tue Feb 15, 2022 11:48 pm

Remove " (*)" unless " (Edited)"

Postby Luuk » Sun Apr 16, 2023 5:25 am

With a checkmark inside for "v2", the "Match" part can look something like...
(?i)(?! \(Edited\)) \([^()]*\)/g

The " \([^()]*\)" is saying your " (*)" except that * cannot be more brackets inside of the brackets.
The (?! \(Edited\)) is a negative look-ahead, so he is telling " \([^()]*\)" to not match " (Edited)".
The (?i) says case-insensitive, so then also not matching any text like ' (edited)' or ' (Edited)'.

The /g says global, so this can remove many different " (*)" inside of the same filename.
If your files are like the other post, and you're only removing " (*)" from the very ends??
Then instead of using /g to say global, should change it to $ to say "at the very end".
Luuk
 
Posts: 706
Joined: Fri Feb 21, 2020 10:58 pm


Return to Regular Expressions


cron