Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regular Expression Help

Status
Not open for further replies.

rye8261

Technical User
Jul 6, 2003
359
US
I am trying to figure out regular expressions for the first time.

I have a string "C:/Program Files/Apache Group/Apache2/htdocs/public_html/Layouts/Alcohol/"
and I'm trying to return just the Alcohol part into a variable, can anyone help me with this.

Right now I'm trying to split it at "Layouts" but it isn't working right and I'm not even sure if that is what I should do.

Thanks

---------------------------------------
- Free General Web Directory, Free Web site submissions.
- Free General Web Directory, Free Web site submissions.
 
sorry if this does not answer your question, but for this issue i would not use regex

use explode() instead
 
I agree, use explode, count the items in the array, and use the second to last one. You may need to play with it a little.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top