Quick question. I am editing a file from the command line with perl, reading the file as one string and replacing some code. I search for the string (across multiple lines) and replace it with what I need. The regexp work but the problem I have is that only the first replace is done, then the other 2 are skipped (the expression should match in 3 places). You can see the "or" in my expression. If I remove the first search term then the second one will work etc. However I cannot get all three to work.
I thought the issue would be the /g modifier but it does not seem to work. Any ideas?
UPDATE: My .* were too greedy.. Should have .*?. doh!perl -0777pi.bak -e 's/(instance \"(?:ta_gpmc|ta_ocm_ram|ta_ocm_rom)\" +.*register addr_match\(1\).*regfield size (?:0|6))/${1}x1f/sg' test
In reply to multiple replace from cmd line by diarmuid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |