I have a regex to remove the html tags to count my characters. Which is working fine.
<string_variable>.replaceAll("<(.|n)*?>","").replaceAll(" "," ").replaceAll("&","&");
alert <string_variavle>.length()
But I need to add the
(New Line) to count my characters.
ABC
DEC
For example above ABC and DEC are 6 characters with 2 break lines it should be 9. As of now it is just counting with 6 characters.
Search for similar issue.
Tweaking my code
2
Answers
You can systematically replace all of your
n
to a different char and then use the length: