fork download
  1. #!/bin/bash
  2. s="alt='Text-01'
  3. alt='Text 02'
  4. alt=''
  5. alt='Some long text'"
  6. grep -oP "alt='(?:\K[^']+|')" <<< "$s"
  7.  
Success #stdin #stdout 0s 4960KB
stdin
Standard input is empty
stdout
Text-01
Text 02
alt=''
Some long text