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

99
Visualizações
How to just pick those matching regex which doesn't contains any value behind

Like I have a text

Lorem https://open.spotify.com/episode/0xmdIsJ28Pwix7MOKcK3Zv?si=50957b8039154544 loremhttps://open.spotify.com/episode/0xmdIsJ28Pwix7MOKcK3Zv?si=50957b8039154544lorem

I want my regex to just pick the first occurrence because it's have empty space behind which show sit's independent

Does any body knows how to check that?

Here's my current regex

/(https:\/\/open.spotify.com\/episode\/|spotify:user:spotify:playlist:)([a-zA-Z0-9]+)(.*)/g
about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

If I'm understanding correctly this regex will select just the first occurance:

/(https:\/\/open.spotify.com\/episode\/|spotify:user:spotify:playlist:)([a-zA-Z0-9?=]+)\b/

Note that the regex is not global so the trailing g was removed.

If you want a global regex that only matches when the URL has a space infront of it, you can use:

/\b(https:\/\/open.spotify.com\/episode\/|spotify:user:spotify:playlist:)([a-zA-Z0-9?=]+)/g

where the \b means a word boundry (space, tab, newline).

about 4 years ago · Juan Pablo Isaza Relatório

0

Remove global g flag at the end of your regex to pick only first entry

about 4 years ago · Juan Pablo Isaza Relatório

0

You can use the following regex:

/(?<=\s|^)(https:\/\/open.spotify.com\/episode\/|spotify:user:spotify:playlist:)([a-zA-Z0-9]+)(.*?)/g

It allows you to select only the ones having a white space before them or at the beginning of the string.

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