Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

58
Vistas
Group first folder and the following files in Regex

I am trying to use regex to group the root folder of a package and to group the rest of the files in it.

I tried the following @package\/(.*)\/(\/*.+)$ with the test string @package/util/src/index.js: Regex

But instead of grouping util/src and index.js I want to group for util and src/index.js. I thought the / between the groups in my regex would match on the first /. What do I miss?

7 months ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You might write the pattern like this to not cross the first / and then capture the rest of the line using (.+)$ without optional repeating \/*

@package\/([^\/]+)\/(.+)$

Regex demo

7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos