사이에 문자열의 텍스트를 바꿉니다자바 스크립트 정규식 : 두 개의 "마커"이 필요
입력
<div>some text [img]path_to_image.jpg[\img]</div>
<div>some more text</div>
<div> and some more and more text [img]path_to_image2.jpg[\img]</div>
출력
<div>some text <img src="path_to_image.jpg"></div>
<div>some more text</div>
<div>and some more and more text <img src="path_to_image2.jpg"></div>
이 내 시도도 실패입니다
var input = "some text [img]path_to_image[/img] some other text";
var output = input.replace (/(?:(?:\[img\]|\[\/img\])*)/mg, "");
alert(output)
//output: some text path_to_image some other text
도움 주셔서 감사합니다!
가 대단히 감사합니다 내 솔루션입니다! 이것은 내가 필요로하는 것입니다 :) – enloz