Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

243
Visualizações
How can I select the sentence after the last *

I have a navigation text and I will select the last sentence after *

Example; Home*Development*Mobil and Web Development

I will only select the last sentece after * --> (Mobil and Web Development)

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

If you want to select Mobil and Web Development from the text, you can use .split(/[*]+/).pop().

Demo

var n = "Home*Development*Mobil and Web Development".split(/[*]+/).pop();
console.log(n)

about 4 years ago · Juan Pablo Isaza Relatório

0

You can use Javascript Regular express for that

let chain = "Home*Development*Mobil and Web Development";

let pattern = /.*\*(.*)$/

let matches = chain.match(pattern);

console.log(matches[1]);

about 4 years ago · Juan Pablo Isaza Relatório

0

Assuming that what you want to do is some styling on the final 'sentence' you can run some JS on startup to find all elements with a particular class, separate out the final part and wrap it in a span and select that:

const selectLasts = document.querySelectorAll('.selectLast');

selectLasts.forEach(selectLast => {
  //note there are 'neater' ways of doing this but each step is deliberately spelled out here to show what is going on
  const text = selectLast.innerHTML;
  const arr = text.split('*');
  const lastText = arr.pop();
  selectLast.innerHTML = arr.join('*');
  const lastEl = document.createElement('span');
  lastEl.innerHTML = '*' + lastText;
  selectLast.appendChild(lastEl);
});
.selectLast span {
  background-color: yellow;
}
<div class="selectLast">Home*Development*Mobil and Web Development</div>

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda