|
-
Oct 23rd, 2001, 08:45 AM
#4
Frenzied Member
Well, to remove the everything before the fifth pound...
Code:
$string =~ s/^(\#.*){4}\#/\#/;
# or
$string =~ s/^(#.*){4}#/#/;
Like I said, I don't think you need to escape the pounds, but it shouldn't break anything if you do.
Now this will modify the string, so you will loose everything at the beginning of the string. There are way around that. You could copy the string and work the with copy.
Another idea is....
Code:
my $string; #the pound enriched string
my @subStrings; #each element is a peice of $string without the #'s
my $result; #the resulting string
my $targetPound; #this is the index of the #s in the string that you want to start reading. 0 is the first
@subStrings = split /#/, $string;
$result = join /#/, $subStrings[$targetPound .. -1]
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|