How to string lines from the_content() hook in WordPress?

I don’t know any other way

There is a much, much better way to do this – custom fields.

Custom Fields

As per these instructions in the custom fields docs, let’s say you use the field name iframe_url:

<iframe src="https://wordpress.stackexchange.com/questions/230707/<?php echo esc_url( get_post_meta( $post->ID,"iframe_url', true ) ?>" width="960" height="540" frameborder="0" allowfullscreen="allowfullscreen"></iframe>

<?php the_content() ?>

See how much cleaner that is? You’ve separated data from content; no nasty regular expressions or string hacking.