改善正则表达

I want to match something like this in PHP:

class-11/xxx/xxx/xx/xxx/things_to_remember/
class-12/xxx/xxx/xx/xxx/things_to_remember/

However I don't want to match something like this:

xxx/class-11/xxx/
class-11/xxx/things_to_remember/xxx
class-11/xxx/

I am writing it like this:

^(class-[12]{2})/.+/things_to_remember/$

I heard regular expression have many features like greedy etc. and they also need to be efficient ? Is the above regualar expression good ?

I wrote a little regex here that captures it like the format you wrote. It might need some slight changes as I didn't know how many digits could be in after class.

/
class-(\d{2}) #Matches class, makes sure that class only is 2 digits - captures class digits
\/([^\/]{3}) #captures first 3 characters that aren't a slash.
\/([^\/]{3}) #Capture 3 characters again.
\/([^\/]{2}) #captures two characters
\/([^\/]{3}) #Captures 3 characters
\/things_to_remember\/ #Matches last piece of string.
/xg

You can test it out here.