Regex to find text between second and third slashes

How you access it depends on your language, but you’ll basically just want a capture group for whatever falls between your second and third “https://stackoverflow.com/”. Assuming your string is always in the same form as your example, this will be:

/.*/(.*)/

If multiple slashes can exist, but a slash can never exist in the database name, you’d want:

/.*/(.*?)/

Leave a Comment