Hello! I’m new to bubble and ran into a problem.
I have a text in the database and it has headings tagged [h2][/h2]

I need to get these headings separately from the text and put them in text elements on the page and then navigate when they are clicked.
I am using this code.
const db = await BubbleSDK.data.getApi();
const records = await db.search(‘content’);
const contentStrings = records.map((record) => {
return record.content;
});
const headings = ;
const regex = /[h2](.*?)[/h2]/g;
for (let i = 0; i < contentStrings.length; i++) {
let match;
while ((match = regex.exec(contentStrings[i]))) {
headings.push(match[1]);
}
}
const myTextElement = await BubbleSDK.element.getElement(‘idid’);
myTextElement.setText(headings.join(‘\n’));
But it doesn’t work.
If you know how to do this, please help me. Thank you!