0

For example, the StackOverflow question URls look like this:

https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it

Somewhere in the code, there's a parser that does the following:

  • hash: ""
  • hostname: "stackoverflow.com"
  • pathname: "/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it"
  • port: ""
  • protocol: "https:"
  • search: ""

And take the pathname's value and parse it using this pattern: /questions/<ID>/<Title>.

When the parser runs what it matters to identify the post is basically the ID, and the title can be basically anything, test it yourself and the following URLs will redirect you to the correct URL:

  • https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it-extra-text
  • https://stackoverflow.com/questions/218384/this-is-a-different-text
  • https://stackoverflow.com/questions/218384 <-- no text at all

Does anyone have an idea what this pattern is called and have references to it?

Sergio Flores
  • 5,231
  • 5
  • 37
  • 60

0 Answers0