Skip to content

Instantly share code, notes, and snippets.

@kuyseng
Created May 26, 2012 03:49
Show Gist options
  • Save kuyseng/2792046 to your computer and use it in GitHub Desktop.
Save kuyseng/2792046 to your computer and use it in GitHub Desktop.
javascript: indesign remove words from string using regexp
function remove_see_see_also ( text ) {
var tmp_str = "";
var my_reg = new RegExp("(^see also )|(^see )|(\t000$)","g");
tmp_str = text.replace(my_reg, "");
// remove unvisible xml tag
var xml_tag_char = "";
xml_tag_char = tmp_str.charCodeAt(0);
if(xml_tag_char === 65279){
tmp_str = tmp_str.replace(tmp_str[0],"");
};
return tmp_str;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment