You can use below method
starts-with()
ends-with()
contains()
element = driver.findElements(By.xpath("//[starts-with(@id, ‘apple_’)]");
element = driver.findElements(By.xpath("//[contains(@id, ‘apple_’)]");
element = driver.findElements(By.xpath("//*[ends-with(@id, ‘apple_’)]");