Regular Expression for Adding an Alt Tag
Posted: Thu Jun 13, 2019 7:38 am
I'd like to use the Find/Replace in Files feature to add an <alt> tag to images that lack it. For example, change
<image deliveryTarget="pdf" href="../graphics/g_c_cda___cda_viewer_permissions_5_9_1.png" id="135356"/>
into
<image deliveryTarget="pdf" href="../graphics/g_c_cda___cda_viewer_permissions_5_9_1.png" id="135356"><alt/></image>
I think this could be done using the Regular Expressions option of Find/Replace, but implementations of Regular Expressions seem to vary a bit. I think I need something like named or numbered backreferences (https://www.regular-expressions.info/re ... ckref.html). Does Oxygen support capturing part of the text in the target and reusing it as part of the replacement value? I'm think of something like this:
Find
<image(capture everything here)/>
Replace
<image(previously captured text)><alt/></image>
Thanks for any suggestions!
<image deliveryTarget="pdf" href="../graphics/g_c_cda___cda_viewer_permissions_5_9_1.png" id="135356"/>
into
<image deliveryTarget="pdf" href="../graphics/g_c_cda___cda_viewer_permissions_5_9_1.png" id="135356"><alt/></image>
I think this could be done using the Regular Expressions option of Find/Replace, but implementations of Regular Expressions seem to vary a bit. I think I need something like named or numbered backreferences (https://www.regular-expressions.info/re ... ckref.html). Does Oxygen support capturing part of the text in the target and reusing it as part of the replacement value? I'm think of something like this:
Find
<image(capture everything here)/>
Replace
<image(previously captured text)><alt/></image>
Thanks for any suggestions!