I have a couple of sentences in parentheses in a couple of files in a folder and I need to find and remove the opening bracket and replace the closing bracket of every parenthesis with a hyphen/dash (-). I don't know if Notepad++ is the best to use for this but I opened one of those files with Notepad++, selected the Regular Expression mode and put this in the "Find" field:-
(<!--.*?-->|<style[\S\s\n]*?</style>|<script[\S\s\n]*?</script>|rgb\(\d+,\x20\d+,\x20\d+\))(*SKIP)(*F)|\((.+?\))\s*again
and
$1 - again
in the Replace in files field to replace (Malé) again
with Malé - again
but when I hit Replace, the closing bracket is not removed. Please give me the correct Regular Expression to replace the parentheses.
This is part of one of the files that can be used as a sample for testing the above RegEx:-
<!-- (Malé) -->
<p>(Malé) again</p>
<p style="font-family: "verdana"; font-size: 18px; color: rgb(0, 0, 0);">Malé again</p>
<style>
code {
font-family: "verdana";
font-size: 18px;
color: black;
font-weight: bold !important;
line-height: 1.6 !important;
}
@media (min-width: 1281px) {
code {
font: 24px "verdana" bold !important;
}
}
</style>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
}
</script>
Removing the opening bracket and replacing the closing bracket with -
(?:<!--.*?-->|<style(?s:.*?)</style>|<script(?s:.*?)</script>|rgb\(\d+,\x20\d+,\x20\d+\))(*SKIP)(*F)|\(([^()]*)\)\s*again
$1 - again
<!-- (Malé) -->
<p>(Malé) again</p>
<p style="font-family: "verdana"; font-size: 18px; color: rgb(0, 0, 0);">Malé again</p>
<style>
code {
font-family: "verdana";
font-size: 18px;
color: black;
font-weight: bold !important;
line-height: 1.6 !important;
}
@media (min-width: 1281px) {
code {
font: 24px "verdana" bold !important;
}
}
</style>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
}
</script>
<!-- (Malé) -->
<p>Malé - again</p>
<p style="font-family: "verdana"; font-size: 18px; color: rgb(0, 0, 0);">Malé again</p>
<style>
code {
font-family: "verdana";
font-size: 18px;
color: black;
font-weight: bold !important;
line-height: 1.6 !important;
}
@media (min-width: 1281px) {
code {
font: 24px "verdana" bold !important;
}
}
</style>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
}
</script>