I've been trying to extract various bits and pieces from a multi-line text in the system clipboard, and assemble into a smaller bit of info, as I have hundreds and hundreds to do. Here's the example:
Restrictions:
Contact your local office for all commercial or promotional uses.
Credit: Shirlaine Forrest / Contributor
Editorial #: 1159057436
Collection: WireImage
Date created: 29 June, 2019
Upload date: 29 June, 2019
Licence type: Rights-managed
Release info: Not released. More information
Source: WireImage
Object name: d4s_3193_2019062944636318.jpg
Max file size: 2417 x 3776 px (20.46 x 31.97 cm) - 300 dpi - 6 MB
I need to grab the bit that follows "Credit: " but ends with the following slash "/" on the same line, and also the "Collection: " entry and then assemble like this:
Shirlaine Forrest / WireImage
I've exhausted all I know about positive look behind (?<=Credit: ) and capturing with something like ([^/]+) ((not a forward slash) but as I don't even know if what I want to do is possible, I thought I'd call it after about 90 minutes of floundering and ask for help! Honestly, not trying to get someone to write my grep for me because I can't be bothered, genuinely asking for some assistance following loads of reading and trial and mainly error!


