<p>Hello, I have what I hope is a quick question. I'm using a small bit of code that receives a feed from an API of a list of items and then displays specific items I'm interested in based on a few variables.</p>
<p>My issue I believe is pretty simple. Say you have an item type that is "Apple". Now it can be a plain "Apple", or sometimes can be a "Juice Apple" or a "Apple Mush", or even a "Juicy Apple Mush". But "Apple" will always be present.</p>
<p>My issue is that the only item type I am getting returned is the plain "Apple" and the possible derivatives as mentioned above do not show up. I've found using a wildcard * does not work. Note I am a complete amateur and really not clear on much of what I'm doing ! :D</p>
<p>I'm hoping there is something simple I'm missing that I can change to allow my searches to not just return plain "Apple", but anything that contains "Apple" along with instances of "Apple" with a modifier that comes before, after or in both positions around "Apple".</p>
<p>This is the code, in this case I am only getting "Breach Leaguestone", but not examples that are modified with a word before or after "Breach Leaguestone", only the plain exact match.</p>
<pre><code>func processStash(stash *api.Stash) {
re := regexp.MustCompile("^~b/o ([0-9\\.]+) ([^ ]+)$")
for _, item := range stash.Items {
matches := re.FindStringSubmatch(item.Note)
if len(matches) < 3 {
continue
}
boQuantity := matches[1]
boCurrency := matches[2]
if item.League == "Legacy" && item.Type == "Breach Leaguestone" && item.ItemLevel >= 69 {
log.Printf("@%v Hi I would like to buy your %v listed for %v %v in %v stash tab %v", stash.LastCharacterName, item.Type, boQuantity, boCurrency, item.League, stash.Label)
}
}
</code></pre>
<p>This is the relevant API: <a href="https://github.com/ccbrown/poe-go/blob/master/api/item.go" rel="nofollow">https://github.com/ccbrown/poe-go/blob/master/api/item.go</a></p>
<p>Thanks in advance for any help! I assume this is a downright simple fix, just beyond my grasp.</p>
<hr/>**评论:**<br/><br/>the_jester: <pre><p>Your regex is very likely not doing what you think it is doing. Test it <a href="https://regex101.com/" rel="nofollow">over here</a>.</p></pre>donniederpo: <pre><blockquote>
<pre><code> if item.League == "Legacy" && item.Type == "Breach Leaguestone" && item.ItemLevel >= 69 {
</code></pre>
</blockquote>
<p>item.Type == "Breach Leaguestone" is your problem here, that requires an exact match for item.Type. You will need to change that to be a lazier match type.</p></pre>Yojihito: <pre><p>Are you building your own poe.trade indexer to beat the 20 second delay on that plattform?</p>
<p>Also they patched the leaguestone trick and banned people for it (but only 00,01% I guess).</p></pre>JamesTCoconuts: <pre><p>Trying to lol.</p></pre>