I'm generating text images using imagemagick by passing user inputs via command. I'm concerned that a user could enter something malicious.
# regex pattern
[^\s\w\.&!?"]
# image generation code, in Ruby
"convert -quality 100 -background black -fill red -font Times-Bold -size x50 label:'#{@line1}' output.jpg"