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

162
Visualizações
find value contain url or not in javascript/ node js

I am trying to check if my output contain url or not if it contain I want to do it like this { "title": "Google", "href": "www.google.com" }

so when I do console.log(data) the output data look like this

generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.
https://www.google.com/
random@gmail.com,
10
https://stackoverflow.com/questions/
![lost--rk](//images.random.net//3234r4/456545/4c653a1c200b5aa1/lost--rk.jpg)
4
default value
radio

so I am trying to check if my data contain url or not

and if it contain the url then it should make a json object which contain the title and href as key and in title the gitst initial value which look like this

{ "title": "Google", "href": "www.google.com" }
{ "title": "Stackoverflow", "href": "https://stackoverflow.com/questions/" }

I tried this code I got from internet

if (new RegExp("([a-zA-Z0-9]+://)?([a-zA-Z0-9_]+:[a-zA-Z0-9_]+@)?([a-zA-Z0-9.-]+\\.[A-Za-z]{2,4})(:[0-9]+)?(/.*)?").test(data)) {
console.log(data);
}

here I am also getting all this

https://www.google.com/
random@gmail.com,
https://stackoverflow.com/questions/
![lost--rk](//images.random.net//3234r4/456545/4c653a1c200b5aa1/lost--rk.jpg)

I only want url not other parts

about 4 years ago · Juan Pablo Isaza
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