I have a string in jquery like following:
var str = "\n \n \n \n Michael Hartl\n \n \n";
but I want to fetch this string into this format as output
str = "Michael Hartl"
I tries with following functions:
str.replace(/\s*/," ")
but it results like
" Michael Hartl
"
is there any other way in jquery to get the desired output?