Good as you might look in a chain for a "specific value.
Ex:
var texto = "hola #que tal# mi nombre es #amigo#" ;
I want to get the string between "# #"
it would be: what a friend
Good as you might look in a chain for a "specific value.
Ex:
var texto = "hola #que tal# mi nombre es #amigo#" ;
I want to get the string between "# #"
it would be: what a friend
Here is the solution.
var texto = "hola #que tal# mi nombre es #amigo#" ;
/// Split por espacios
var split = texto.split(' ');
var arr = [];
/// Por cad astring que contenga #, remplazar por nada,
/// en caso de que haya dos, remplazar dos veces.
split.forEach(e => {
if(e.indexOf('#') != -1){
arr.push(e.replace('#', '').replace('#', ''))
}
})
/// Unir con espacios
var finalstring = arr.join(' ');
console.log(finalstring);
/// que tal amigo