Hello! There is a task to get the text that is outside the html tags. For example: '<strong>Hello, <em>World!</em></strong> 1 + 2 < 4!' , from this line the line should turn out: ' 1 + 2 < 4!' . Or, if the line is generally without tags, then it should return.
I tried this: ([\s\S]+)(?![^<]*>|[^<>]*<\/)/gi , but for some reason it does not work (I canβt understand why) just returns the entire string). Please, help!
regexp.exec(str)with thegflag to find all the templates/<.+?>/. By this example, navigate. So find all the tags in the string. Then find the first and last index tags. Then cut the specified string, excluding a substring that is long from the first index of the first tag to the last index of the last tag. I hope that clearly explained. - DogeDev