mercredi 1 juillet 2015

How to get a portion of a string with a regular expression

I have this situation where I can have strings like this:

"Project\\V1\\Rest\\Car\\Controller"
"Project\\V1\\Rest\\Boat\\Controller"
"Project\\Action\\Truck"
"Project\\V1\\Rest\\Helicopter\\Controller"
"Parental\\Boat\\Action"

Just in case the string follow the pattern:

"Project\\V1\\Rest\\THE_DESIRED_WORD\\Controller"

I want to get THE_DESIRED_WORD.

That's why I'm thinking in a regular expression.

Aucun commentaire:

Enregistrer un commentaire