News for hackers. Stuff that matters.

Ask HN: What is the best default behavior for defining RegExp routes?

Hello,

I'm creating PHP routing library. I doubt about default behavior for defining RegExp routes.

There is two alternatives, with (^ and $) by default, or without it.

1. /news/[id:[0-9]+]

/news/[slug:today.*]

2. /news/[id:^[0-9]+$]

/news/[slug:^today]

First looks more convenient for defining routes. Second looks like any other RegExp as we writing it outside of routing.

What do you think about it?

There is the issue: https://github.com/baryshev/TreeRoute/issues/3

( no comments | on HN )

There are no comments yet.