英文:
How to split paragraphs/object in DOM with react
问题
I can help with the translation. Here's the translated code part without any additional information:
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';
If you have any further questions or need additional assistance, please feel free to ask.
英文:
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('&nbsp;', ' ').split("<br><br>")[0] + '... \n\n';
Please help..
答案1
得分: 1
这样做应该可以:
```YourArticleSelector.innerText``` 应该返回所有文本,而不包括HTML标签,类似于以下内容:
我们的客户,一家备受尊敬的搬家公司正在寻找一名遥远地点工作的全国客户移动协调员。\n
\n\n
成功的候选人将在家庭物品搬迁和搬迁行业拥有经验。\n
\n\n
全国客户移动协调员的职责
现在您可以:
job.description.split(/\n\n/g)[0].trim()
您应该得到您想要的内容
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论