Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Stripping unwanted text
Old 07-05-2006, 11:29 AM Stripping unwanted text
numbenator's Avatar
Webmaster Talker

Posts: 523
Location: London
Trades: 0
Hi

I wish to create a php script that

strips text up to / and after .

ie "theClickClub/soho.swf"

will become "soho"

How do i do this.

thanks for you help.

Steve
__________________

Please login or register to view this content. Registration is FREE

Last edited by numbenator; 07-05-2006 at 11:30 AM..
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
 
Register now for full access!
Old 07-05-2006, 12:05 PM Re: Stripping unwanted text
Webmaster Talker

Posts: 626
Trades: 0
I just did a similar thing... This should work, try it and I think you will be able to adapt it.

Code:
<?php
$text = "theClickClub/sohomortgages/sdfdsf/sdfsdlj%20sdfs&sdfsd=asdfs/index.php?dsjfls=sdfsd&sdfds=342/";
$pos = strlen($text);
if(substr($text, $pos-1, 1) == "/") {
	$text = substr($text,0,$pos-1);
}

$text = ereg_replace("[^/]*/|\.[^.]*", "", $text)."<br>";
echo $text;
?>
jim.thornton is offline
Reply With Quote
View Public Profile
 
Old 07-05-2006, 12:15 PM Re: Stripping unwanted text
numbenator's Avatar
Webmaster Talker

Posts: 523
Location: London
Trades: 0
Thats wicked.
Works a treat thanks very much
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
Reply     « Reply to Stripping unwanted text
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.63329 seconds with 12 queries