This one has been driving me crazy.
Mike's solution works, but what if it was a 6 character string? Maybe a regex wouldn't be the best option.
There's a quantifier - {MIN,MAX} which means "match MIN times but no more than MAX times" which might do the trick but I can't seem to get it...
this could work too.. in case there's a space in the filename
m ~ ( /.*/ # everything between first and last slash
\w+ # followed by a word
\. # a dot
\w+) # another word
~x;
-or-
m~( /.*/\w+\.\w+)~x;
ok.. I can see what it's doing now. It's looking for a sentence starting and ending with the values in
%startindexstring and %endindexstring
in the case of MSN - the sentence to look for is:
"of about 841 containing"
%startindexstring = "of about" (a sentence that starts...
oops.. forgot the eng/fr
s/^.*(eng|fr)$DATE.*$/mydomain\.dart\/nlsample/g;
parens will look for eng or fr only if grouped together -
brackets will treat each character inside individually.
[eng|fr] = e or n or g or |(actual pipe character)or f or r
the ^ and $ anchor the beginning and end...
will this take care of it?
$_ = "newsletter.mydomain/;kw=frNov18tracking";
$DATE="Nov18";
print "$_\n";
s/^.*$DATE.*$/mydomain\.dart\/nlsample/g;
print "$_\n";
That's what it seems like.. check out this comment:
#the following string represent the criteria needed to parse through
#the HTML page to find link popularity
what is this script for exactly? It's hard to tell without seeing the entire script.
It looks like it's searching the html for the number of hits a search produced. The number represents the distance (offset) of the number from... something. The search engine websites may have changed their wording since that script was written, because I can't seem to find any correlation.
Out of curiosity, I performed a crude test to see the difference in speed by rounding the same number 10 million times...
OpenWater's method was indeed the fastest at a blistering 16 seconds.
it seems my silly clusterf**k of a program wasn't as slow as I thought it would be - it was tied with...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.