I have a template in a file that may / may not span multiple lines:
abcd25
ef_gh
( fg*_h
hj_b*
hj ) {
What I tried:
perl -nle 'print while m / ^ \ s * (\ w +) \ s + (\ w +?) \ s * (([\ w-0-9, * \ s])) \ s {/ gm
I don't know what flags mean here, but all I did was write regexfor the template and paste it into the template space. This works well if the template is on the same line as:
abcd25 ef_gh ( fg*_h hj_b* hj ) {
But it crashes exclusively in the multi-line case!
I started with perl yesterday, but the syntax is too confusing. So, as one of our SO partners suggested, I wrote a regexand pasted it into the code it provided.
I hope the monk perlcan help me in this case. Alternative solutions are welcome.
Input file:
abcd25
ef_gh
( fg*_h
hj_b*
hj ) {
abcd25
ef_gh
fg*_h
hj_b*
hj ) {
jhijdsiokdù ()lmolmlxjk;
abcd25 ef_gh ( fg*_h hj_b* hj ) {
:
abcd25
ef_gh
( fg*_h
hj_b*
hj ) {
abcd25 ef_gh ( fg*_h hj_b* hj ) {
, .
.