<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection">
<div dir="auto">So I've been digging into this a bit, and it would appear that the `toUpper()` method on the SWBuf class isn't working. I did a little hacking on the SWModule class and dropped in some debugging `printf` calls to see what was going on and why I wasn't getting my expected results. Here are I print out the word being queried:<br />
<br />
```<br />
printf("word check: %s\n", words[i].toUpper().c_str());<br />
```<br />
<br />
And here is the result:<br />
<br />
```<br />
word check: God<br />
```<br />
<br />
I'm doing this in between lines 771 and 772 in `swmodule.cpp`. I did the same type of thing on the `textBuf` in the search method and no casing is changed. Any thoughts on all this?<br />
<br />
I am wondering if it has to do with the more modern OS that I am using. I am attempting this on Ubuntu 20.04, and Sword 1.9.0 (which is the latest version best I can tell) is over 2 years old.<br />
<br />
That brings me to the next question: What is the development status on this? Is it being actively worked on? I would be willing to get involved, but I am only just now learning C/C++, So I would need some hand-holding, so-to-speak, to get me up to speed.<br />
<br /></div>
</div>
<div name="messageSignatureSection"><br />
- Patrick</div>
<div name="messageReplySection">On Apr 19, 2023 at 10:32 AM -0500, Patrick Stephan <pstephan1187@gmail.com>, wrote:<br />
<blockquote type="cite">
<div name="messageBodySection">
<div dir="auto"><span style="color:#ffffff;font-family:system-ui;font-size: 14px">I am new to c/c++ and to this library, so I could be misunderstanding how the module search system works, but I think I may have found a bug?</span><span style="font-size: 14px"><br /></span><span style="font-size: 14px"><br /></span><span style="color:#ffffff;font-family:system-ui;font-size: 14px">Here is my code:</span><span style="font-size: 14px"><br /></span><span style="color:#ffffff;font-family:system-ui;font-size: 14px">```</span><span style="font-size: 14px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">#include </span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">"vector"</span><span style="font-size: 16px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">#include </span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">"swmgr.h"</span><span style="font-size: 16px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">#include </span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">"swmodule.h"</span><span style="font-size: 16px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">#include </span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">"markupfiltmgr.h"</span><span style="font-size: 16px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">#include </span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">"modules.h"</span><span style="font-size: 16px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">#include </span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">"php_sword.h"</span><span style="font-size: 16px"><br /></span><span style="font-size: 16px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">#if </span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">defined(USECXX11REGEX)</span><span style="font-size: 16px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">#include </span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px"><regex></span><span style="font-size: 16px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">#ifndef </span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">REG_ICASE</span><span style="font-size: 16px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">#define </span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">REG_ICASE std::regex::icase</span><span style="font-size: 16px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">#endif</span><span style="font-size: 14px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px">#elif defined(USEICUREGEX)</span><span style="font-size: 14px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">#include </span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px"><unicode/regex.h></span><span style="font-size: 16px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">#ifndef </span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">REG_ICASE</span><span style="font-size: 16px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">#define </span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">REG_ICASE UREGEX_CASE_INSENSITIVE</span><span style="font-size: 16px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">#endif</span><span style="font-size: 14px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">#else</span><span style="font-size: 14px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">#include </span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px"><regex.h></span><span style="font-size: 16px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">#endif</span><span style="font-size: 14px"><br /></span><span style="font-size: 14px"><br /></span><span style="color:#d19a66;font-family:JetBrains Mono, monospace;font-size: 14px">using namespace</span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">::sword;</span><span style="font-size: 16px"><br /></span><span style="font-size: 16px"><br /></span><span style="font-family:JetBrains Mono, monospace;font-size: 14px">// unrelated function here...</span><span style="font-size: 14px"><br /></span><span style="font-size: 14px"><br /></span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 14px">int </span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">sword_search_module(</span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 16px">char</span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">* module_name, </span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 16px">char</span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">* search_string) {</span><span style="font-size: 16px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px"> SWMgr mgr(</span><span style="color:#d19a66;font-family:JetBrains Mono, monospace;font-size: 16px">new </span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">MarkupFilterMgr(FMT_XHTML));</span><span style="font-size: 16px"><br /></span><span style="font-size: 16px"><br /></span><span style="font-family:JetBrains Mono, monospace;font-size: 14px">// mgr.setGlobalOption("Headings", "On");</span><span style="font-size: 14px"><br /></span><span style="font-family:JetBrains Mono, monospace;font-size: 14px">// mgr.setGlobalOption("Strong's Numbers", "Off");</span><span style="font-size: 14px"><br /></span><span style="font-family:JetBrains Mono, monospace;font-size: 14px">// mgr.setGlobalOption("Lemmas", "Off");</span><span style="font-size: 14px"><br /></span><span style="font-family:JetBrains Mono, monospace;font-size: 14px">// mgr.setGlobalOption("Greek Accents", "Off");</span><span style="font-size: 14px"><br /></span><span style="font-family:JetBrains Mono, monospace;font-size: 14px">// mgr.setGlobalOption("Footnotes", "On");</span><span style="font-size: 14px"><br /></span><span style="font-family:JetBrains Mono, monospace;font-size: 14px">// mgr.setGlobalOption("Cross-references", "On");</span><span style="font-size: 14px"><br /></span><span style="font-size: 14px"><br /></span><span style="font-family:JetBrains Mono, monospace;font-size: 14px"> </span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">mgr.setGlobalOption(</span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">"Headings"</span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">, </span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">"Off"</span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">);</span><span style="font-size: 16px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px"> mgr.setGlobalOption(</span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">"Strong's Numbers"</span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">, </span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">"Off"</span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">);</span><span style="font-size: 16px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px"> mgr.setGlobalOption(</span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">"Lemmas"</span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">, </span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">"Off"</span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">);</span><span style="font-size: 16px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px"> mgr.setGlobalOption(</span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">"Greek Accents"</span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">, </span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">"Off"</span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">);</span><span style="font-size: 16px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px"> mgr.setGlobalOption(</span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">"Footnotes"</span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">, </span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">"Off"</span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">);</span><span style="font-size: 16px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px"> mgr.setGlobalOption(</span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">"Cross-references"</span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">, </span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">"Off"</span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">);</span><span style="font-size: 16px"><br /></span><span style="font-size: 16px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px"> SWModule *module = mgr.getModule(module_name);</span><span style="font-size: 14px"><br /></span><span style="font-size: 14px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px"> </span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">/*</span><span style="font-size: 16px"><br /></span><span style="font-family:JetBrains Mono, monospace;font-size: 14px"> * >=0 - regex; (for backward compat, if > 0 then used as additional REGEX FLAGS)</span><span style="font-size: 14px"><br /></span><span style="font-family:JetBrains Mono, monospace;font-size: 14px"> * -1 - phrase</span><span style="font-size: 14px"><br /></span><span style="font-family:JetBrains Mono, monospace;font-size: 14px"> * -2 - multiword</span><span style="font-size: 14px"><br /></span><span style="font-family:JetBrains Mono, monospace;font-size: 14px"> * -3 - entryAttrib (eg. Word//Lemma./G1234/) (Lemma with dot means check components (Lemma.[1-9]) also)</span><span style="font-size: 14px"><br /></span><span style="font-family:JetBrains Mono, monospace;font-size: 14px"> * -4 - clucene</span><span style="font-size: 14px"><br /></span><span style="font-family:JetBrains Mono, monospace;font-size: 14px"> * -5 - multilemma window; flags = window size</span><span style="font-size: 14px"><br /></span><span style="font-family:JetBrains Mono, monospace;font-size: 14px"> */</span><span style="font-size: 14px"><br /></span><span style="font-size: 14px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px"> ListKey results = module</span><span style="color:#e5c07b;font-family:JetBrains Mono, monospace;font-size: 16px">-></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">search(search_string, -</span><span style="color:#d19a66;font-family:JetBrains Mono, monospace;font-size: 16px">2</span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">, REG_ICASE);</span><span style="font-size: 16px"><br /></span><span style="font-size: 16px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px"> </span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 16px">for </span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">(</span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 16px">int </span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">i = </span><span style="color:#d19a66;font-family:JetBrains Mono, monospace;font-size: 16px">0</span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">; i < results.getCount(); i++) {</span><span style="font-size: 16px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px"> module</span><span style="color:#e5c07b;font-family:JetBrains Mono, monospace;font-size: 16px">-></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">setKey(results.getElement());</span><span style="font-size: 16px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px"> std::cout</span><span style="font-size: 14px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px"> << results.getText()</span><span style="font-size: 14px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px"> << </span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 16px">" - "</span><span style="font-size: 16px"><br /></span><span style="color:#98c379;font-family:JetBrains Mono, monospace;font-size: 14px"> </span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px"><< module</span><span style="color:#e5c07b;font-family:JetBrains Mono, monospace;font-size: 16px">-></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">renderText()</span><span style="font-size: 16px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px"> << std::endl;</span><span style="font-size: 14px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px"> results.increment();</span><span style="font-size: 14px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px"> }</span><span style="font-size: 14px"><br /></span><span style="font-size: 14px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px"> </span><span style="color:#c678dd;font-family:JetBrains Mono, monospace;font-size: 16px">return </span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 16px">results.getCount();</span><span style="font-size: 16px"><br /></span><span style="color:#abb2bf;font-family:JetBrains Mono, monospace;font-size: 14px">}</span><span style="font-size: 14px"><br /></span><span style="color:#ffffff;font-family:system-ui;font-size: 14px">```</span><span style="font-size: 14px"><br /></span><span style="font-size: 14px"><br /></span><span style="color:#ffffff;font-family:system-ui;font-size: 14px">Given that code, If I run a search for "so loved god" against the KJV module, I get 3 verses: Hosea 2:23, Hosea 3:1, and I Timothy 6:2. I'm not sure why I Tim 6:2 is listed because it contains niether "so", nor "god". There are also a slew of verses that are expected to show up but don't (like John 3:16), presumably because the case-insensitive flag `SEARCHFLAG_STRICTBOUNDARIES | REG_ICASE</span><span style="font-size: 14px"><br /></span><span style="color:#ffffff;font-family:system-ui;font-size: 14px">` isn't working. BTW, I am compiling my code against Ubuntu 20.04 and `REG_ICASE` resolves to `2`.</span><span style="font-size: 14px"><br /></span><span style="font-size: 14px"><br /></span><span style="color:#ffffff;font-family:system-ui;font-size: 14px">Also, If I include the `SEARCHFLAG_STRICTBOUNDARIES` flag like so: `SEARCHFLAG_STRICTBOUNDARIES | REG_ICASE`, and search for 'god so loved', I get no results, further enforcing my theory that the `REG_ICASE` flag isn't doing anything. If I search for 'God so loved' then I get 6 results. I am, however expecting 10. Here are the verses that are not returned that I expect to:</span></div>
<ul>
<li style="font-size: 14px"><span style="color:#ffffff;font-family:system-ui;font-size: 14px">Nehemiah 13:26</span></li>
<li style="font-size: 14px"><span style="color:#ffffff;font-family:system-ui;font-size: 14px">Galatians 2:20</span></li>
<li style="font-size: 14px"><span style="color:#ffffff;font-family:system-ui;font-size: 14px">2 Peter 1:17</span></li>
<li style="font-size: 14px"><span style="color:#ffffff;font-family:system-ui;font-size: 14px">I John 4:10</span></li>
</ul>
<div dir="auto"><span style="color:#ffffff;font-family:system-ui;font-size: 14px">I have also tried with replacing the if/else block at the top with just `#include "regex.h"`. But that makes no difference.</span><span style="font-size: 14px"><br /></span><span style="color:#ffffff;font-family:system-ui;font-size: 14px">Thank you for any help</span></div>
</div>
<div name="messageSignatureSection"><br />
- Patrick</div>
</blockquote>
</div>
</body>
</html>