Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

if text is in curly braces replace to div site:stackoverflow.com

function getParams(input){
  var matches = [];
  input.replace(/({+)([^}]+)(}+)/g,function(orig,lb,txt,rb){
      if (lb.length === rb.length)
        matches.push(txt);
  });
  return matches;
}
var string = "<div>{{foo}} and {{{bar}}} and {{{{hahahaahahahahahaha}}}}</div>";
document.write(getParams(string));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #text #curly #braces #replace #div
ADD COMMENT
Topic
Name
7+9 =