> say "Yes" if "2018 xJul 7" ~~ m:i/j :i ul/; you mean
say "Yes" if "2018 xJul 7" ~~ m/j :i ul/; m/.../ - not m:i at the start! -y On Mon, Sep 10, 2018 at 4:54 AM, Laurent Rosenfeld via perl6-users < perl6-us...@perl.org> wrote: > Hi Todd, > > you may use: > > say "Yes" if "2018 xJul 7" ~~ /:i jul/; > > or: > > say "Yes" if "2018 xJul 7" ~~ m:i/jul/; > > In the second case, the adverb will apply to the whole pattern. In the > first case, it will start to apply from the point where the adverb is. In > this specific example, those two code samples will be equivalent since the > adverb is at the beginning of the pattern. But it would make a difference > if the adverb is somewhere else within the pattern. For example, this would > fail: > > say "Yes" if "2018 xJul 7" ~~ m:i/j :i ul/; > > because the ignore case adverb would apply only on the 'ul' characters of > the pattern, but not on the 'j'. > > More on adverbs in regexes: https://docs.perl6.org/ > language/regexes#Adverbs > > Cheers, > Laurent. > > > Le lun. 10 sept. 2018 à 00:00, ToddAndMargo <toddandma...@zoho.com> a > écrit : > >> On 09/08/2018 12:23 PM, Laurent Rosenfeld via perl6-users wrote: >> > Using the fc method is certainly a good way to do case insensitive >> > string comparisons, but you may at this point also use a regex with the >> > :i (ignore case) adverb. >> > >> > > if "2018 xJul 7" ~~ /:i jul/ {say "Yes";} >> > Yes >> > >> >> Hi Laurent, >> >> Thank you! Another weapon in my tool box! >> >> Question: this confused me when I first look at it. I am use to >> the ":x" command being outside the first "/". For instance >> s:g/ >> >> What are the rules for what goes inside and what goes outside? >> >> Also, do y have a link to what the various ":x" commands are >> that I can use? >> >> I generally prefer to use "contains", "starts-with", and >> "ends-with" when the string is full of trash that regex needs >> to escape. For example: >> >> if $Line.contains( '<h1>HWiNFO <span class="modraDownload2">' & '</span> >> Installer</h1>' ) { >> >> >> Many thanks, >> -T >> >> >> -- >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> When we ask for advice, we are usually looking for an accomplice. >> -- Charles Varlet de La Grange >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> >