LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Perl regex not matching across multiple lines despite ms flags (https://www.linuxquestions.org/questions/programming-9/perl-regex-not-matching-across-multiple-lines-despite-ms-flags-826600/)

gfarrell 08-18-2010 04:10 AM

Quote:

Originally Posted by ghostdog74 (Post 4069645)
Code:

awk -vRS="}" '/myFunction:/{
    gsub(/.*myFunction:/,"myFunction: (")
    gsub(/{.[^}]*/,"...\n");
    print $0RT")"
}' file


Unfortunately this has only a limited application. I did not, however, realise that awk could do regex, which it can, by the looks of your answer.

My original regex was quite sufficient, I would love to know why it didn't work in perl but did in two regex testers.


All times are GMT -5. The time now is 11:43 PM.