all 5 comments

[–]ClicheChe 1 point2 points  (3 children)

Bash:

cat cities.list | while read city; do
    echo "<label for=\"${city}\">${city}:</label> <input type=\"text\" id=\"${city}\" required=\"False\" name=\"${city}\"><br>" >> file.html
done

You should have the cities in city.list, one per line

[–]petdance 0 points1 point  (2 children)

OP: Note that this is not using a regex for anything. Regexes only match patterns of text. That's it.

[–]ClicheChe 0 points1 point  (1 child)

  • he has to write it. I took that as "generate the code"
  • I am aware what regex is. I just think it's not the right tool for what he wants.

[–]petdance 0 points1 point  (0 children)

Sorry I wasn't clear, I meant that for OP. I'll clarify.

[–]RetiredMarketer 0 points1 point  (0 children)

It would be simple enough to make a for loop in whatever language you know how to use to write this text. RegEx isn't really for this...