JSFiddle - React, Tailwind, and code Playground

by hakkim

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
 <p>this "is" a "text" <small>this is "small" text</small>
        </p>
        <h1>"this" is "another"</h1>

JavaScript

$('p, h1, h2, h3, h4, h5, div, span, small, b, strong, li').each(function(){

                    var re = /([^"]*"[^"]*)"/gm; 
                    var str = $(this).text();
                    var subst = '$1»'; 
                    var result = str.replace(re, subst);
                    var resultOdd = result.replace(/"/g, '«');
                    $(this).text(resultOdd);
                
            });