regex - Including character that was used in the pattern search in the match -
i have string:
[?q]this test[?p] <br> [?q]this test<random_tag>
i want text between [?q]
, [?p]
or [?q]
, <
. want keep <
in match results. have regex:
\[\?q\](.*?)(?:\[\?p\]|<)
but if replace of first group aaa, this:
aaa <br> aaarandom_tag>
i want this:
aaa <br> aaa<random_tag>
try
change regex /\[\?q\](.*?)(?:\[\?p\]|(?=<))/g
or try other regex have mentioned below
var str = '[?q]this test[?p]\n<br>\n[?q]this test<random_tag>'; var res = str.replace(/(\[\?q\].*?\[\?p\]|\[\?q\].*?(?=<))/g, 'aaa'); console.log(res);
i have used positive lookahead check if value followed <
Best eCOGRA Sportsbook Review & Welcome Bonus 2021 - CA
ReplyDeleteLooking for https://vannienailor4166blog.blogspot.com/ an eCOGRA Sportsbook Bonus? https://deccasino.com/review/merit-casino/ At this eCOGRA ventureberg.com/ Sportsbook review, we're talking about https://febcasino.com/review/merit-casino/ a https://septcasino.com/review/merit-casino/ variety of ECCOGRA sportsbook promotions.