$ perl -wle'use re "debug"; $x = "foo\nbar"; qr/(?x)hullo #there $x/' Compiling REx `(?x)hullo #there foo bar' size 4 Got 36 bytes for offset annotations. first at 1 1: EXACT (4) 4: END(0) anchored `hullobar' at 0 (checking anchored isall) minlen 8 Offsets: [4] 5[20] 0[0] 0[0] 25[0] Freeing REx: `"(?x)hullo #there foo)\nbar"'