On Mon, Aug 11, 2008 at 5:02 PM, DeeDee Messersmith <[EMAIL PROTECTED]> wrote:
> I have strings such as the following:
>
> .INSERT,SCREW THREAD..............
>
> I need the leading dots but not the trailing. As you see it has commas and 
> spaces in it so the traditional \w doesn't work. the .* doesn't work as it 
> picks up the trailing dots. The result I want back is:
>
> .INSERT,SCREW THREAD
>
> I have tried pulling the entire thing off using \S+
> and then doing this: (it still doesn't work) I thought it would anchor at the 
> end and pull of one or more of the trailing dots and then assign the rest of 
> the field to the left to $1.
>
> Also, the string does not always have leading dots but if it does I must have 
> them.
> Thanks a bunch,

__CODE__
my $str = ".INSERT,SCREW THREAD..............";
$str =~ s/\.+$//;
print "$str\n";      
__OUTPUT__
.INSERT,SCREW THREAD

RegEx: Remove any dots at the 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to