Regex find and replace between <div class="customclass"> and </div> tag -
i cant find anywhere working regex expression find , replace text between div tags
so there html want select between <div class="info"> , </div> tag , replace other texts
<div class="extrauserinfo"> <p>hello world! sample text</p> <javascript>.......blah blah blah etc etc </div> and replace with
my custom text codes <tags> asdasd asdasdasdasdasd</tags> so
<div class="extrauserinfo"> custom text codes <tags> asdasd asdasdasdasdasd</tags> </div> here refiddle code there , can see want replace whole bunch of codes between , tag
hope mean :)
if there's no nesting, plain match non-greedy (lazy)
(?s)<div class="extrauserinfo">.*?</div> .*?matches amount of character (as few possible) meet</div>- used
smodifier making dot match newlines too.
edit: here javascript-version without s modifier
/<div class="extrauserinfo">[\s\s]*?<\/div>/g and replace new content:
<div class="extrauserinfo">my custom...</div>
Comments
Post a Comment