@singuerinc

2014-01-12

Extract #hashtags

javascript, string, hashtags, regex

Hoy: Extraer mĂșltiples hashtags de una cadena de texto.

function extract(value){
    return value.match(/\B#\w*[a-zA-Z]+\w*/ig);
}

var tags = extract("lorem #tag1 #tag2 diem #tag3");
tags; // ['#tag1', '#tag2', '#tag3']

Demo