0

(I can't imagine how this question is off-topic, it is only asking about a regex just like a dozen questions on stackoverflow !!!!!!!!!)

In order to find a solution to the question User-friendly URLs for user profiles in YaF one way of solving it is by finding a regex to capture anything else other than the predefined list of controllers,

So I need a regex to match this /notAcontroller where notAcontroller is not one of my predefined controllers like in this array [index, home, profile]

Example:

For these controllers [index, home, profile]

I need to match for strings like these: /Joan, /abdelhady/photos

but not these: /profile/get/id/222, /index or even /

Community
  • 1
  • 1
AbdelHady
  • 9,334
  • 8
  • 56
  • 83
  • What is the language? And what have you attempt to solve the problem? – nhahtdh Sep 19 '13 at 12:30
  • PHP, & I'm trying to solve the problem I've listed before in this question http://stackoverflow.com/questions/18875717/user-friendly-urls-for-user-profiles-in-yaf – AbdelHady Sep 19 '13 at 12:45
  • I can't imagine how this question is off-topic, it is only asking about a regex just like a DOZEN questions here on stackoverflow !!! anyway, I edited it to further explain my problem – AbdelHady Sep 22 '13 at 11:42

1 Answers1

2

Use a negative look ahead anchored to start:

^/(?!(index|home|profile)$).*

See a live demo

Bohemian
  • 412,405
  • 93
  • 575
  • 722