Perl regex word matching
By : mRJ
Date : March 29 2020, 07:55 AM
I wish this help you How do I match the following strings using a perl regexp ? , (?:PAT1|PAT2) is to patterns as [ab] is to chars. code :
/^(?:(?:extern|pure|virtual|void)\s+)*function/
|
Removing word from regex in perl
By : Nishant Gandhi
Date : March 29 2020, 07:55 AM
around this issue I have a string which can has a value like, code :
EXT::USCC::USCCAuth,?|,?EXT::USCC::USCCAuth
|
How to regex first letter of each word perl
By : Sco Max
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I need to grep out just the first letters of a string. , Try this: (remove +)
|
Perl regex first word
By : Ping Lu
Date : March 29 2020, 07:55 AM
it helps some times I am very new to regex in perl and I have the following line: code :
#!/usr/bin/perl
use strict;
use warnings;
my $line = q{MD5ajdhe728ndsdhsds83ndsds /some/path/};
$line =~ /^MD5([a-zA-Z0-9]+)/;
print $1;
|
Why does this regex in perl work for one word but not another?
By : yangqiang
Date : March 29 2020, 07:55 AM
may help you . use 5.006 kind of odd if you are just beginning to learn Perl ... That is an ancient version. code :
use strict;
use warnings;
use File::Find;
my @files;
find(
sub {
return if -d;
return unless / [.] pl \z/x;
push @files, $File::Find::name;
},
'.',
);
for my $file ( @files ) {
open my $fh, '<', $file
or die "Could not open file $file: $!";
while (my $line = <$fh>) {
if (my ($substring) = ($line =~ m{ (?:file|directory) \( ([^\)]*) \) }x)) {
print "$substring\n";
}
}
close $fh;
}
# file(stuff)
# directory(other)
stuff
other
|