Yêu cầu thg 9 16, 2021 8:52 SA 76 0 2
  • 76 0 2
0

Replace String in String

Chia sẻ
  • 76 0 2

Chào mọi người, mình có một vấn đề nhỏ xin mọi người giúp đỡ với ạ.

Mình đang làm chức năng search và highlight text, mình thực hiện replace như sau:

"<a href="&quot;mailto:support@seesoop.com&quot;">support@seesoop.com</a>".replaceAll('support@seesoop.com','<span>support@seesoop.com</span>')

Kết quả hiện tại là: <a href="&quot;mailto:<span>support@seesoop.com</span>&quot;"><span>support@seesoop.com</span></a>

Kết quả mình mong muốn là: <a href="&quot;mailto:support@seesoop.com&quot;"><span>support@seesoop.com</span></a>

Mong mọi người giúp mình với ạ.

2 CÂU TRẢ LỜI


Đã trả lời thg 9 16, 2021 4:07 CH
+1

Bạn thử xem được không

image.png

Chia sẻ
Đã trả lời thg 9 29, 2021 9:41 SA
0

#---

'<a href="&quot;mailto:support@seesoop.com&quot;">support@seesoop.com</a>'.replace(/(=?>)(support@seesoop.com)/g,'<span>$2</span>')
Chia sẻ
Viblo
Hãy đăng ký một tài khoản Viblo để nhận được nhiều bài viết thú vị hơn.
Đăng kí