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

156
Visualizações
Matching a specific string between foward slash or # using regex

I'm trying to make this regex:

([?=section\/en\/]*)([^\/#]*)

For these examples:

https://www.test.com/en/string-to-get#cid=4949
https://www.test.com/en/section/string-to-get/page&2#cid=4949
https://www.test.com/en/section/string-to-get#cid=4949

current regex

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You need to use

(?<=section\/)([^\/#]*)

Or, just

section\/([^\/#]*)

and grab Group 1 value.

Here,

  • (?<=section\/) - a positive lookbehind that matches a location immediately preceded with section/ substring
  • ([^\/#]*) - Capturing group 1: zero or more chars other than / and #.

See the regex demo #1 and regex demo #2.

Depending on whether or not regex delimiters are required and if they are not /s you may use an unescaped /, (?<=section/)([^/#]*) and section/([^/#]*).

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