줄바꿈에 상관없이 포인트 텍스트의 위치를 찾는다
const pointTextArrayNum = 1;
const renderText = thisComp.layer("RenderText")
.text.sourceText.replace(/\r/g, "");
const pointTextArray = thisComp.layer("PointText")
.text.sourceText.split("$$");
const findStartPositions = (renderText, pointTextArray, curIndex = 0) =>
pointTextArray.map(pt => {
const startIndex = renderText.indexOf(pt, curIndex);
curIndex = (startIndex > 0 ? startIndex : curIndex) + pt.length;
return startIndex;
})
result = findStartPositions(renderText, pointTextArray);
[result[pointTextArrayNum-1] ?? -1]