How can i split the context for say if i have the following example? I want to only extract this sentence "Our client, a highly respected moving company is seeking a National Account Move Coordinator to join their team based remotely."
<article>
Our client, a highly respected moving company is seeking a National Account Move Coordinator to join their team based remotely.
<br>
<br>
The successful candidate will have experience within the Household Goods Moving and Relocation Industry.
<br>
<br>
<strong>National Account Move Coordinator responsibilities:</strong>
</article>
This is my code at the moment but it does not pull the sentence that i wanted… it pull everything instead..
const body =
'We are hiring for the following opportunity: \n' +
job.title + ' - ' + job.location + ' \n' +
job?.description.replace(/<[^>]*>?/gm, '').replace(' ', ' ').split("<br><br>")[0] + '... \n\n';
Please help..
>Solution :
Well something like this will do
YourArticleSelector.innerText should return all the text without the HTML tags something like
Our client, a highly respected moving company is seeking a National Account Move Coordinator to join their team based remotely.\n
\n\n
The successful candidate will have experience within the Household Goods Moving and Relocation Industry.\n
\n\n
National Account Move Coordinator responsibilities
Now you can just
job.description.split(/\n\n/g)[0].trim()
You should get what you want