The incident happened in Greenhead Park, Huddersfield, at around 4.30pm on Monday, February 25.
The victim, a 25-year-old man, was walking along the pavement on Greenhead Road when he was attacked from behind by the suspects and stabbed in the chest. .
The man sustained a serious injury in the incident.
A 17-year-old male and an 18-year-old male were arrested in connection with the assault and have been released under investigation.
Detective Constable Joanne Jabczynski said: “We believe this was a targeted attack on the victim, and thankfully he wasn’t more seriously injured and has since been discharged from hospital.
“Our enquiries remain ongoing and I would appeal for anyone with any information or anyone who witnessed the incident to contact police.”
Anyone who witnessed the assault or has any information is asked to contact police on 101, quoting crime reference 13190102822.
Those wishing to remain anonymous can also contact independent charity Crimestoppers on 0800 555 111.