我有一个字符串,需要将其转换为可读形式。预期输出附在底部。这基本上是html在 js 中读取字符串。我浏览了各种文章,但没有找到任何东西。如何读取此字符串以生成预期的输出。我试过这个,但不太奏效。我不替换Enter字符串中的字符。str = str.replace(/<\/?[^>]+(>|$)/g, '');预期输出:This course carries 4 hours of Continuing Professional Development (CPD) credits. In support of the Journalism Now Scholar Programme, for a limited time, there is no charge for the course certificate. COURSE OVERVIEW This course will help give your use of social media a journalistic purpose. You'll learn how to find good stories, whether you're using Facebook, Twitter, Instagram, or any other form of social media. Once you've completed the course, you will be able to understand each of the social media platforms - they all have their own system which you will be able to get to grips with and you will discover how to refine your searches so that you get the information you need more easily. The course will help you become a good 'social listener' by giving you the best hashtags to use, as well as the best keywords. "The content is really good, I enjoyed it because I went in without knowing much but finished the course more knowledgeable. I learnt a lot of things." Pheladi from South Africa WHAT YOU WILL LEARN• How to use SOCIAL MEDIA to FOLLOW breaking news and to FIND STORIES as well as sources. • How to use ADVANCED SEARCH TECHNIQUES as a tool for finding information and locating experts.• How to use social media to verify if a BREAKING NEWS story is true.• How to establish the ORIGIN OF PHOTOGRAPHS and how to verify them. MEET YOUR INSTRUCTORS SUE LLEWELLYN is your course instructor. For the past 10 years, Sue has worked as a trainer for thousands of journalists, teaching them how to use social media. Before that, she was a journalist for 15 years in the BBC Newsroom.   Helping Sue is a team of experts (from left to right):
1 回答

胡子哥哥
TA贡献1825条经验 获得超6个赞
使用此正则表达式解决它:
description.replace(/(<!--.*?-->)|(<!--[\w\W\n\s]+?-->)|<\/?[^>]+(>|$)/g, '');
添加回答
举报
0/150
提交
取消