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

249
Visualizações
Regex on picking S3 bucket name from S3 URI

I have been trying to regex pattern to obtain S3 bucket name from S3 URI but have no luck.

example: s3://example-bucket/file-name.filetype

Closest I could get with this: \/\/([^\/].*[^\/])\/ but i'm not sure how to negate the slash from the result

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

The part ([^/]+) is looking for a sequence of of characters that are not slash. keeping close with what you had you could write //([^/]+)/ but this is the same as

//([^/]+)

optional you could use lookbehind (?<=//) and/or lookahead (?=/)

(?<=//)([^/]+)(?=/)

(depending on your use cases a couple of different lookahead expressions are possible)

'lookaround' especially 'lookbehind' is not supported in all regexp dialects. e.g. not in JavaScript

Debuggex Demo

over 4 years ago · Santiago Trujillo Relatório

0

If you don't have the lookbehind option (javascript regex), and your URL structure is consistent enough, then perhaps this pattern will be useful:

[^\/]+(?=\/[^\/])

In English: "match one or more non-forward slashes, followed (but not actually matched, via the lookahead) by one forward slash and a non-forward slash".

(your other option would be to access your match groups in order to get rid of the slashes that you matched)

https://regex101.com/r/XM05Sw/2/

over 4 years ago · Santiago Trujillo 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