Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Perl treats period as space in string

by tybalt89 (Monsignor)
on Jul 20, 2021 at 20:14 UTC ( [id://11135229]=note: print w/replies, xml ) Need Help??


in reply to Perl treats period as space in string

if ($string =~ m/\Q$phrase\E/i){

Replies are listed 'Best First'.
Re^2: Perl treats period as space in string
by htmanning (Friar) on Jul 20, 2021 at 20:29 UTC
    Thanks!

      Note that this also matches fooclub.market. Not sure if that's what you want. If you want to perform an exact case-insensitive comparison, use

      if ($string =~ /^\Q$phrase\E\z/i)
      or
      use feature qw( fc ); if (fc($string) eq fc($phrase))

      The second is probably faster.

      Seeking work! You can reach me at ikegami@adaelis.com

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11135229]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-24 07:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found