Hey guys, having trouble making a regex. Basically I'm trying to replace {{ page.content }} Code (markup): inside a string, but I need it so white space doesn't matter. {{page.content}} Code (markup): {{ page.content}} Code (markup): {{page.content }} Code (markup): {{ page.content }} Code (markup): You get the idea, how would I go about doing this?
Hi Kewl. The following should do it I guess: x.replace(/{{\s*page.content\s*}}/,'Spain'); Code (JavaScript): for texts like: var x = 'The rain in {{page.content}} stays mainly in the plain'; var x = 'The rain in {{ page.content}} stays mainly in the plain'; var x = 'The rain in {{page.content }} stays mainly in the plain'; etc etc... Ref:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp