简体   繁体   中英

remove certain special characters from Text

Hey guys I am making a project on PhantomJS where I read source code of some webpages and i extract some info i need from there. I successfully finished the work just one issue I am facing right now. I have a text that have inside it special characters I need to get rid off. in my case I have :

Avenue de Citeaux 22<br><br>1348 Louvain-la-Neuve

that "<><>" i need to get rid off, I am using :

str.replace('<br><br>','')

but its not working ... any ideas ?

尝试str.replace(/<br>/g, "") (启用了全局搜索标志的正则表达式,以替换所有出现的情况)。

something like this?

str = str.replace(/(<([^>]+)>)/ig,"");

I've just realised, str.replace() RETURNS the value, not replaces it. Try the above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM