Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How do I implement a negative look-behind regular expression without using `(?

$
0
0

I know about the negative look behind (?<!) operator, but it appears that the Javascript engine used in Expo/React-Native does not support it. What I want is to implement the following

export function processEmbedded(text: string): string {  return text.replace(/(?<!!)\[Embedded\]/gm, "![Embedded]");}

What I did was a bit hacky in that I stripped and re-added.

export function processEmbedded(text: string): string {  return text    .replace(/!\[Embedded\]/gm, "[Embedded]")    .replace(/\[Embedded\]/gm, "![Embedded]");}

For my cases it does work, but I am pretty sure there's an edge case where it does not.


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>