ref: How do you search an array for a substring match?How do you search an array for a substring match?
The solution given here is generic unlike the solution 4556343#4556343solution 4556343#4556343, which requires a previous parse to identify a string with which to join()
, that is not a component of any of the array strings.
Also, in that code /!id-[^!]*/
is more correctly, /![^!]*id-[^!]*/
to suit the question parameters: