var text = "The rain in SPAIN stays mainly in the plain";[br]alert(text.match("ain").join(" "));[br][br]var text = "The rain in SPAIN stays mainly in the plain";[br]alert(text.match(/ain/).join(" "));[br][br]var text = "The rain in SPAIN stays mainly in the plain";[br]alert(text.match(/ain/g).join(" "));[br][br]var text = "The rain in SPAIN stays mainly in the plain";[br]alert(text.match(/ain/i).join(" "));[br][br]var text = "The rain in SPAIN stays mainly in the plain";[br]alert(text.match(/ain/gi).join(" "));[br][br]var text = "The rain in SPAIN stays mainly in the plain";[br]alert(text.match(/ain$/).join(" "));[br][br]var text = "Hola mundo";[br]alert(text.match(/(H)(o)(l)(a) (m)(u)(n)(d)(o)/).join(" "));[br][br]var text = "Hola mundo";[br]str = text.match(/(H)(o)(l)(a) (m)(u)(n)(d)(o)/).groups;[br]alert(JSON.stringify(str));[br][br]////////////////////////////////////////////////////////////////[br]//Solo letras mayúsculas[br]var text = "The rain in SPAIN stays mainly in the plain";[br]alert(text.match(/[A-Z]/g).join(" "));[br][br]//Solo letras minúsculas[br]var text = "The rain in SPAIN stays mainly in the plain";[br]alert(text.match(/[a-z]/g).join(" "));[br][br]//Solo vocales minúsculas[br]var text = "The rain in SPAIN stays mainly in the plain";[br]alert(text.match(/[aeiou]/gi).join(" "));[br][br]//Solo vocales mayúsculas[br]var text = "The rain in SPAIN stays mainly in the plain";[br]alert(text.match(/[AEIOU]/gi).join(" "));[br][br]//Solo vocales minúsculas y mayúsculas[br]var text = "The rain in SPAIN stays mainly in the plain";[br]alert(text.match(/[aeiouAEIOU]/g).join(" "));[br][br]//Solo consonantes minúsculas[br]var text = "The rain in SPAIN stays mainly in the plain";[br]alert(text.match(/[bcdfghjklmnpqrstvwxyz]/gi).join(" "));[br][br]//Solo consonantes mayúsculas[br]var text = "The rain in SPAIN stays mainly in the plain";[br]alert(text.match(/[BCDFGHJKLMNPQRSTVWXYZ]/gi).join(" "));[br][br]//Solo consonantes minúsculas y mayúsculas[br]var text = "The rain in SPAIN stays mainly in the plain";[br]alert(text.match(/[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]/g).join(" "));[br][br]//////////////////////////////////////////////////////////////////[br][br]//Solo letras dígitos[br]var text = "The rain 23 in SPAIN stays mainly in the plain";[br]alert(text.match(/\d+/g).join(" "));[br][br]//Solo caracteres especiales[br]var text = "Hola123!@#";[br]alert(text.match(/[^a-zA-Z0-9]/g).join(" "));