recentpopularlog in

therobyouknow : match   24

How to extract a directory and filename from a path in a string, Perl Regular Expressions - Kewl Splitpath One Liner Regex
Kewl Splitpath One Liner Regex

Check out this splitpath command:
my($text) = "/etc/sysconfig/network-scripts/ifcfg-eth0";
my($directory, $filename) = $text =~ m/(.*\/)(.*)$/;
print "D=$directory, F=$filename\n";
regular  regexp  regex  expression  regularexpression  match  matching  howto  programming  software  reference  development  perl  linux  tutorial  search  code  computing  coding  scripting  tip  path  directory  find  extract  filename  parse 
january 2010 by therobyouknow
Re: Regexp multiple match
my $s = "batcatbetnetbitfit";

my $p = "b.t";

my @matches = $s =~ /$p/g;
g is the key.
Put the regex in brackers () inside the // and use $1..$n to access the result from each bracket.
regex  multiple  match  perl  several  duplicate  repeat  pattern  occurence  programming  howto  work  computing 
november 2009 by therobyouknow
Perl Regular Expressions
The most basic string comparison is
$string =~ m/sought_text/;
The above returns true if string $string contains substring "sought_text", false otherwise
howto  software  programming  reference  development  perl  search  tutorial  code  language  documentation  script  regexp  expression  regular  match  find  within  string  substring  work  tip  contain 
september 2009 by therobyouknow

Copy this bookmark:

to read