2016-04-04 20 views
-1

Örneğin - (: smile :) veya (: riya :) ya da (: para :) ile birlikte bulunduğumda, yani, bulduğumda) bazı örüntüleri takip etmek istiyorum. (: 've' :) ', yer değiştirir. ÖrneğinJavascript'teki metinde bir desen arama

:

This is a demo text (:ritu:) to demonstrate (:money:) what is the problem. 

Sonuç:

This is a demo text to demonstrate what is the problem. 

Nasıl javascript ile bunu başarmak için?

cevap

1

çok str.replace

var str = 'This is a demo text (:ritu:) to demonstrate (:money:) what is the problem.' 
 
alert(str.replace(/\s?\(:.*?:\)/g, ''))

+0

Teşekkür kullanımı. –