dimanche 19 avril 2015

Regex to get text between final two slashes

Taking a string with the following three examples...



/Services/Research/Consumer-services/Mobile-Services/
/Services/Research/Consumer-services/Fixed-Broadband-and-Multi-Play/
/Services/Research/Consumer-services/Next-Generation-Services/


I need to:


a) Strip so I only have the string contained between the two final slashes (ie. "Mobile-Services" ... /.*/(.*)/ seems to accomplish this, though I don't fully understand ti.


b) Replace dashes in the remaining text with spaces. So, "Mobile-Services" becomes "Mobile Services" and "Fixed-Broadband-and-Multi-Play" becomes "Fixed Broadband and Multi Play"


Thank-you very much.


Aucun commentaire:

Enregistrer un commentaire