Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

BBS: Re: Perl string manipulation - September 18, 1998 at 09:30:53

You are here: irt.org | BBS | Re: Perl string manipulation [This BBS is closed]

Posted by Jason Nugent on September 18, 1998 at 09:30:53:

In Reply to: Re: Perl string manipulation posted by Bob on September 18, 1998 at 08:42:23:

: Hi guys,
: Thanks for taking the time to help but when I have tried these two expressions :

: $pish =~ s/| (\w+)|$/$1/;
: $pish =~ s/\|\w+\|\+-+\+\| (\w+?)\|$/$1/;

: I get the exact same string in the variable. Any other ideas?

: Ta,
: Neil

Really? This the code I used to test it: Try this:

## reg.pl
$string = '|password|+----------+|rangers|';
$oldstring = $string;

$string =~ s/\|\w+\|\+-+\+\| (\w+?)\|$/$1/;

print $1 . "\n\n";
print "string is $oldstring\n";
print "Data is $string\n";

.. and the output I get when I run this:

rangers

string is |password|+----------+|rangers|
Data is rangers


So.... let's see your code?

Jason
Follow-ups:

You are here: irt.org | BBS | Re: Perl string manipulation [This BBS is closed]

©2018 Martin Webb