i am using a regex to search through html and highlight results. it works very well in all but ios version < 16.4 because they dont support regex lookbehind. can someone help me change my regex because i have tried several alternative but they never leave the html image tags alone :-(
const regex = new RegExp('(?<!</?[^>]*|&[^;]*)(' + $search.value + ')', 'gi');
i get the following error in safari: Invalid regular expression: invalid group specifier name
i have read about putting (?<!</ into a non-captured group but cant get it working
changed
(?<!</
into
(?:</
now it doesn't match anything anymore
You could try:
Example: