대소 문자를 구분하지 않으려 고합니다. &은 Apps API를 사용하여 Google 문서 도구에서 바꿉니다. 이 옵션을 설정할 수있는 함수 (예 : 슬라이드 또는 사용자 인터페이스)를 찾을 수 없으므로 body.replaceText()를 사용해야합니다. 또한 변수를 사용하여 찾기 문자열을 설정하고 싶지만 명시 적으로 지정된 값으로 작업 할 수도 없습니다.Google Apps docs : body.replaceText 대소 문자를 구분하지 않습니다.
다른 버전을 사용해 보았습니다.
var findValue = "foo"; = "바"
1) var regex = new RegExp('\\bfindValue\\b','gi');
body.replaceText(regex,replaceValue);
2) var regex="/(\\b)"+findValue+"(\\b)/gi";
body.replaceText(regex,replaceValue);
3) body.replaceText("/(\\b)"+findValue+"(\\b)/gi",replaceValue);
4) body.replaceText(/foo/gi,"bar");
심지어 4 NR) var에 replaceValue 텍스트에 푸 또는 foo는 찾습니다. 제안 사항이 있으십니까?
이 [thread] (https://stackoverflow.com/questions/30968419/replacetext-regex-not-followed-by)를 참조하십시오. ['replaceText()'] (https://developers.google.com/apps-script/reference/document/body#replaceText (String, String)) 메소드는 reverse-lookaheads 나 다른 어떤 것을 지원하지 않습니다. 캡처 그룹. 이러한 제한은 DocumentApp 서비스에만 적용됩니다. 따라서 낮은 수준 (단락 등에서 텍스트 추출)에서 문서를 조작 할 수 있어야하지만 매우 빠르게 번거로워 질 수 있습니다. – abielita