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.
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.
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 !
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".
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.
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)
}
}
This is the relevant API: https://github.com/ccbrown/poe-go/blob/master/api/item.go
Thanks in advance for any help! I assume this is a downright simple fix, just beyond my grasp.
评论:
the_jester:
donniederpo:Your regex is very likely not doing what you think it is doing. Test it over here.
Yojihito:if item.League == "Legacy" && item.Type == "Breach Leaguestone" && item.ItemLevel >= 69 {
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.
JamesTCoconuts:Are you building your own poe.trade indexer to beat the 20 second delay on that plattform?
Also they patched the leaguestone trick and banned people for it (but only 00,01% I guess).
Trying to lol.
