I have text like this:
....foo..bar....
foo and bar can be any text at all.
It could also be:
anypreamble....foo..bar....anypostamble
I'm trying to match just foo and just bar but I keep matching the entire thing.
Here's some code:
var s = "this....AAAAAAAAAA..BBBBCD....that";
console.log(s.replace(/\.{4}.+\.{2}(.+)\.{4}/g, 'X'));
I would expect the above to give me: thisAAAAAAAAAAXthat, instead it gives: thisXthat.
Can you help?
Here's a fiddle: https://jsfiddle.net/vfkzdg9y/1/
'X', try using a capture group and backreference.