<?xml version="1.0" encoding="windows-1252"?>
<node id="948649" title="Re: Possible Match Problem" created="2012-01-18 18:39:25" updated="2012-01-18 18:39:25">
<type id="11">
note</type>
<author id="732669">
Marshall</author>
<data>
<field name="doctext">
&lt;c&gt;
#!/usr/bin/perl -w
use strict;

my $str1 = "Hi(";
my $str2 = "hi";

if ($str2 =~ /\Q$str1\E/) #\Q...\E means like qr
                           #don't interpret characters
                           #like '(' within $str1
                           #use them verbatim
{
    print "Match: Yes\n";
}
else
{
    print "Match: No\n";
}
#prints Match: No


$str2 = "hI(";
if ($str2 =~ /\Q$str1\E/i) #/i means case insensitive
{
    print "Match: Yes\n";
}
else
{
    print "Match: No\n";
}
#prints Match: Yes
&lt;/c&gt;

Basically if you want to match upon string where one or more characters would mean something to a Perl regex, you need to say that: "I don't want these special characters to count, i.e. mean something in a regex sense" - otherwise when Perl interpolates that string, those characters "will count". There are a couple of ways to say "please use all these characters verbatim", I showed one of these.&lt;strike&gt; qr is another.&lt;/strike&gt;</field>
<field name="root_node">
948631</field>
<field name="parent_node">
948631</field>
</data>
</node>
