http://www.perlmonks.org?node_id=423357


in reply to Simple regex

Maybe this is what you're looking for:
$text =~ s/(.+\s)\S*\.\S*/$1/g;


OUTPUT:
0000 636d6400 5589e583 ec0831c0 83e4f0e8 0010 00000000 e8000000 0083ec0c 68000000 0020 00e80000 000031c0 c9c39090 90909090

Replies are listed 'Best First'.
Re^2: Simple regex
by Isothop (Acolyte) on Jan 19, 2005 at 13:42 UTC
    thanks for your help but the problem is still there.
    this is my source code :
    #!perl -w # use strict; # # Hashes my %struct_compilation = ( "objdump" => "%s -j .text -s -z %s", ); my %compilation = ( "objdump" => "", ); my %return = ( "objdump" => "", ); my $path = "D:/Progs/Programmation/Dev-Cpp/bin/"; my %compiler = ( "objdump" => $path . "objdump.exe", ); # # Main if( @ARGV < 1 ) { exit( 0 ); } my $src = $ARGV[0]; $compilation{"objdump"} = sprintf( $struct_compilation{"objdump"}, $co +mpiler{"objdump"}, $src ); $return{"objdump"} = `$compilation{"objdump"}`; $return{"objdump"} =~ s/[0-9a-f]{4}//g ; print $return{"objdump"};
    i want to print the hexa decimal string whitch is returned by objdump but my regex do the contrary !
      Replace
      $return{"objdump"} =~ s/[0-9a-f]{4}//g;
      with
      $return{"objdump"} = join("",$return{"objdump"} =~ /[0-9a-f]{4}/g)
        thanks to you ! it works :)

      For those of us not blessed with windows and objdump can you post a frag of the objdump output so we can see what to aim for.

      Thanks,
      R.

      Pereant, qui ante nos nostra dixerunt!