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

154
Vistas
Regex to match s3 link

I have a s3 object in the following format.

https://s3-{region}.amazonaws.com/{bucket}/{environment}/{keyname}

I need a regex which can fetch me the individual variables from a s3 link. Currently I have the following regex.

r"https\:\/\/s3\-(\w+)\.amazonaws\.com\/(\w+)\/(\w+)\/(\w+)$"

But it returns None.

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You could go for:

https?://s3-
(?P<region>[^.]+).amazonaws.com/
(?P<bucket>[^/]+)/
(?P<environment>[^/]+)/
(?P<keyname>.*)

See a demo on regex101.com.


In Python this would be:

import re

rx = re.compile(r'''
    https?://s3-
    (?P<region>[^.]+).amazonaws.com/
    (?P<bucket>[^/]+)/
    (?P<environment>[^/]+)/
    (?P<keyname>.*)''', re.VERBOSE)

links = rx.findall(your_string_here)
about 4 years ago · Santiago Trujillo 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