Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
encontrar valor contiene url o no en javascript / node js

Estoy tratando de verificar si mi salida contiene URL o no si contiene Quiero hacerlo así { "title": "Google", "href": "www.google.com" }

entonces cuando hago console.log(data) los datos de salida se ven así

 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

así que estoy tratando de verificar si mis datos contienen URL o no

y si contiene la url, entonces debería crear un objeto json que contenga el título y href como clave y en el título el valor inicial más grande que se vea así

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

Probé este código que obtuve de 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); }

aquí también estoy recibiendo todo esto

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

solo quiero url no otras partes

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!