当前位置:网站首页>Rich text style word image processing
Rich text style word image processing
2022-07-25 08:51:00 【Moran ink dyeing】
export default const clearStyle = (input) => {
var stringStripper = /(\n|\r| class=(")?Mso[a-zA-Z]+(")? ^p)/g;
var output = input.replace(stringStripper, ' ');
// 2. strip Word generated HTML comments
var commentSripper = new RegExp('<!--(.*?)-->','g');
var output = output.replace(commentSripper, '');
// 3. remove tags leave content if any
var tagStripper = new RegExp('<(/)*(meta|link|span|\\?xml:|st1:|o:|font)(.*?)>','gi');
output = output.replace(tagStripper, '');
// 4. Remove everything in between and including tags '<style(.)style(.)>'
var badTags = ['style', 'script','applet','embed','noframes','noscript'];
for (var i=0; i< badTags.length; i++) {
tagStripper = new RegExp('<'+badTags[i]+'.*?'+badTags[i]+'(.*?)>', 'gi');
output = output.replace(tagStripper, '');
}
// 5. remove attributes ' style="..."'
var badAttributes = ['style', 'start'];
for (var i=0; i< badAttributes.length; i++) {
var attributeStripper = new RegExp(' ' + badAttributes[i] + '="(.*?)"','gi');
output = output.replace(attributeStripper, '');
}
output = output.replace(/<\/?html.*?>/ig,'')
output = output.replace(/<\/?body.*?>/ig,'')
output = output.replace(/<\/?title.*?>/ig,'')
output = output.replace(/<\/?head.*?>/ig,'')
output = output.replace(/<\/?b>/ig,'')
output = output.replace(/<\/?i.*?>/ig,'')
output = output.replace(/[\s]+class=MsoNormal/ig,'')
output = output.replace(/&#[0-9]+;/ig,'')
output = output.replace(/ /ig,'')
output = output.replace(/<p\s+><\/p>/ig,'')
// output = output.replace(/<a .*?>/ig,'')
output = output.replace(/<\/a.*?>/ig,'')
output = output.replace(/<\/?u>/ig,'')
output = output.replace(/<\/pre>/ig,'')
output = output.replace(/<\/?divcourier.*?>?/ig,'')
return output;
}
边栏推荐
- Wechat applet ordering system graduation design of applet completion works (2) applet function
- table表格展开内部行切换效果
- Basis 33: XPath acquisition methods of page elements under various browsers
- Efcore's solution of multi tenant zero script, table and database read-write separation under SaaS system
- OpenGL es to realize the visualization of real-time audio
- 这是我见过写得最烂的Controller层代码...
- Freemaker template engine
- Fundamentals of C language
- 附加:在在下部分区/县(数据表)
- Wechat reservation of the completed works of the applet graduation project (6) opening defense ppt
猜你喜欢

Wechat sports ground reservation applet graduation design of applet completion works (2) applet function

Wechat reservation applet graduation project (7) mid term inspection report of applet completion works

@Implementation principle of Autowired annotation

这是我见过写得最烂的Controller层代码...

Initial knowledge of WebService (generate jar packages and call methods in remote services)

This week's big news | FCC exposed Pico 4 VR all-in-one machine, and leipeng's parent company established a smart glasses laboratory

canvas动态图片头像晃动js特效

@Autowired注解的实现原理

英特尔就产品延误向Xe HPG寻宝游戏获奖者道歉并公布奖品样貌

Graduation design of wechat small program ordering system of small program completion works (5) assignment
随机推荐
The fifth day of MATLAB learning (cycle type)
PHP gets all child nodes under any parent node of the tree structure
Django4.0 + Web + MySQL5.7 实现简单登录操作
Yolov5 environment configuration
[untitled]
51 MCU internal peripherals: serial port communication
BigDecimel转人民币大写
【万字长文】使用 LSM-Tree 思想基于.Net 6.0 C# 实现 KV 数据库(案例版)
sticksy.js页面滚动div固定位置插件
JDBC的API解析
酷炫canvas动画冲击波js特效
LabVIEW experiment - temperature detection system (experimental learning version)
PHP reports an error: classes\phpexcel\cell php Line(594) Invalid cell coordinate ESIGN1
Intel apologized to the winners of Xe HPG treasure hunt game for product delay and announced the appearance of the prize
[Sesame Street family] & Bert Bart Roberta
Centernet network structure construction
Leetcode · 83 biweekly race · 6129. Number of all 0 subarrays · mathematics
Wechat reservation applet graduation design of applet completion works (2) applet function
NVIDIA programmable reasoning accelerator tensorrt learning notes (II) - practical operation
技术面②Mysql中的索引(index)类型有哪些并简要介绍一下?什么时候需要创建索引?什么时候不需要创建索引?为什么创建索引后查询速度会提高?