Load the text information that corresponds with the given regular expression from Synap Editor.


Parameters:

NameTypeDescription
regexObjectRegular expression for the text to load



Return:

TypeAttributeDescription
Array[
    { id: "paragraphId1", text: "+Article 1 (Purpose)" },
    { id: "paragraphId2", text: "+Article 2 (Definition)" },
    ....
]
paragraph id of the paragraph in which the text is located and the text



Example:

var textInfoList = editor.getTextByRegex(/\+제\d+조\([가-힣\s\d\w]+\)/g);




Example


Sample of Inserting a Bookmark through getTextByRegex

Move the caret using "setCaretById" Selection API that moves the caret based on the paragraph ID and insert the bookmark using "insertBookmark" bookmark inserting EDIT API, with the text found by the regular expression as the bookmark ID.


Example:

var textInfoList = editor.getTextByRegex(/\+제\d+조\([가-힣\s\d\w]+\)/g);
/* return value
[
    { id: "paragraphId1", text: "+Article 1 (Purpose)" },
    { id: "paragraphId2", text: "+Article 2 (Definition)" },
    ....
]
*/


textInfoList.forEach(textInfo => {
	editor.execCommand('setCaretById', textInfo.id);
	editor.execCommand('insertBookmark', textInfo.text);
});