develooper Front page | perl.perl6.users | Postings from November 2017

tip: case insensitive test

Thread Next
From:
ToddAndMargo
Date:
November 3, 2017 22:31
Subject:
tip: case insensitive test
Message ID:
cf679918-7c8e-35d8-618d-7695aec02113@zoho.com
Dear List,

Okay, I am pretty sure there are no copyrights here.

I had a problem where I had to read through a YUGE log file and
pick out those entries with a particular name in it.  Problem"
it was the same name but three different capitalizations and
the the capitalization was a moving target.  I couldn't count
on it staying the same.

and `i/test/` or `:i/test/` did not work.

One of the guys helped me out with this on the chat line.
`m:i/test/` did the trick, and forgave me for not actually
doing a match.  He said one of the benefits of "m" was that
it allows for more things like "i" to be included

Here is a test one liner:

$ perl6 -e 'my $x="abcDEF"; if ( $x ~~ m:i/abcdef/ ) { say "yes";} else 
{ say "no";}'

yes


-T

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Having been erased,
The document you're seeking
Must now be retyped.
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About