I need to extract the text (characters and numbers) from a multiline string. Everything I have tried does not strip out the line feeds/carriage returns.
Here is the string in question:
"\r\n 50145395\r\n "
In HEX it is: 0D 0A 20 20 20 20 20 20 20 20 35 30 31 34 35 33 39 35 0D 0A 20 20 20 20
I have tried the following:
$sitename =~ m/(\d+)/g;
$sitename = $1;
and
$sitename =~ s/^\D+//g;
$sitename =~ s/\D+$//g;
and
$sitename =~ s/^\s+//g;
$sitename =~ s/\s+$//g;
In all cases I cannot get rid of any of the unwanted characters. I have run this in cygwin perl and Strawberry perl.
Thanks.