re = /(.*)\nNegative prompt: (.*)\nSteps: (\d+), Sampler:(.*), CFG scale: (\d+), Seed: (\d+), Size: (.*), Model hash: (.*), Model:(.*), Denoising strength: (.*), Eta: (.*), First pass size: (.*)/
str = 'professional [digital airbrush:photo:0.5] art of an imp with sword, wearing old cloak, curly pale red-blonde hair, with few tattoos, dynamic bright atmospheric lighting
Negative prompt: logo, text, signature, (bad art)
Steps: 75, Sampler: DPM++ 2M Karras, CFG scale: 12, Seed: 3334373882, Size: 768x1152, Model hash: 81761151, Model: Stable1.5, Denoising strength: 0.7, Eta: 0.89, First pass size: 0x0'
subst = 'Prompt|$1\\nNegative prompt|$2\\nSteps|$3\\nSampler|$4\\nCFG scale|$5\\nSeed|$6\\nSize|$7\\nModel hash|$8\\nModel|$9\\nDenoising strength|$10\\nEta|$11\\nFirst pass size|$12'
result = str.gsub(re, subst)
# Print the result of the substitution
puts result
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html