in reply to Re: special pattern reading
in thread special pattern reading

your version reads the first "3" characters and everything after ".c" I need to read everything until the 3rd special character before the "/"

#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; my $string = '!2!ab!!!!/pack/something/whatever.cacshdska'; my ($before, $after) = $string =~ /(...)\W.*something.*\.c(.*)/; say for $before, $after;

Output is "!2!acshdska" while I need output to be "!2!ab!acshdska" sorry if I wasn't clear enough ...my bad.

Replies are listed 'Best First'.
Re^3: special pattern reading
by choroba (Cardinal) on Jan 13, 2016 at 11:58 UTC
    OK, I think I understand now. Or don't I?
    #!/usr/bin/perl use warnings; use strict; use feature qw{ say }; for my $string ( '?!?!?!/pack/something/whatever.cacshdska', '!2!ab!!!!/pack/something/whatever.cacshdska', ) { my ($before, $after) = $string =~ m{(.*)..\W/.*\.c(.*)}; say "$before | $after"; }
    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

      that's it :D thank you a lot