How does nodejs brush out all the Chinese in the text? Extract all Chinese from a html page or js text (and remove all annotated text)?

how does nodejs brush out all the Chinese in the text? Extract all Chinese from a html page or js text (retain any characters between the characters and remove all annotated text) and put it into another text?


        // var getId = function(id) {
        //  return document.getElementById(id)
        // }
        /*!!*/
        document.getElementById = (function (func) {
            return function () {
                return func.apply(document, arguments)
            }
        })(document.getElementById)
        var getId = document.getElementById;
        console.log(getId("div1"))

        /*      var func = function(a, b, c) {
          "use strict";
          console.log(this)
          console.log(this === window)
        }
        func.apply(null, [1,2,3])*/

        /*  document.getElementById("div1").onclick = function() {
            var func =function() {
              console.log(this.id)
            }
            func.call(this)
          }*/


        Function.prototype.bind = function (context) {
            /*  var self = this;
              return function() {
                return self.apply(context, arguments)
              }*/

            var self = this,
                context = [].shift.call(arguments), // 
                args = [].slice.call(arguments); // 

            console.log(context, arguments, args)
            return function () {
                // 
                return self.apply(context, [].concat.call(args, [].slice.call(arguments)))
            }
        }

        var obj = {
            name: "sven"
        }

        var func = function (a, b, c, d) {
            console.log(this.name)
            console.log([a, b, c, d])
        }.bind(obj, 1, 2)
        func(3, 4)

        /**
         * 
         *
         * @param {*} [params=[]]
         */
        function HelloWord(params = []) {
            console.log(":", ...params)
        }
    </script>
</body>

</html>

I don't quite understand what you need to get Chinese. If you want to get the text inside the tag, you can use cheerio. If you really want to get Chinese, you can convert it all to Unicode and then judge the scope of Chinese. If you remove the comments, you still have to rely on the rule = -.

Menu