Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

109
Vistas
Extracting data from string by splitting URL twice

I would like to achieve the following:

I have a URL: https://www.example.com/Place/Name.html?randomtext

I need to return "Name" only on outgoing links.

I thought it would work by doing the following:

    function() {
      if ({{outgoing link}})
      var Name= {{Click URL}};
      return Name.split("/")[2];
      return Name.split("?")[0];
    }

I already managed to get "place" by doing:

    function() {
          if ({{outgoing link}})
          var Name= {{Click URL}};
          return Name.split("/")[2];
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

One way to get the filename ("Name") would be to do:

var filename = url.substring(url.lastIndexOf('/')+1).split(".")[0]

https://codesandbox.io/s/magical-roman-uerpcp?file=/src/index.js

about 4 years ago · Juan Pablo Isaza Denunciar

0

not sure if this is what u want:

const url = 'https://www.example.com/Place/Name.html?randomtext'

 function extractSliceFromUrl() {
      return url.split("/")[4].split(".")[0];
    }
    

const url = 'https://www.example.com/Place/Name.html?randomtext'

 function extractSliceFromUrl() {
      return url.split("/")[4].split(".")[0];
    }
    
    console.log(extractSliceFromUrl(url))

    console.log(extractSliceFromUrl(url))
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda