I am trying to write a regex for Javascript that can select all whitespaces in between AMPScript
brackets, the syntax for the Lang is something like this
%%[
set @truth = 'this is amp'
IF @truth == 'this is amp' THEN
set @response = 'amp rocks'
ELSE
set @response = '️...'
ENDIF
]%%
So far, I am able to select all the characters inside the given brackets using this expression:
%%\[(\s|.)*?\]%%
But this selects all the characters inside the enclosure, is there a method I can use to only select spaces/new lines/tabindents only?
Thanks in advance!
CodePudding user response:
I believe this is what you want:
(?<=%%\[(\s|.)*)\s*(?=(\s|.)*\]%%)