in reply to regexp match up to but not incliuding...
Update: I didn't mean to apply the //s flag to the ending-regex; should have been /^(?:(?!ending-regex)(?s:.))*/.
In your case, to do something like that you would need to switch to slurping in the whole file instead of reading line by line (by undef'ing $/). You may prefer to keep the code you have and just interrogate the return value of your ..:
The scalar .. operator returns a positive count if you are in the range. At the end of the range the count has "E0" appended to it, explicitly so you can check for this condition.while (<>) { my $inrange = /^\.subckt/../^\w/; if ( $inrange && $inrange !~ /E/ ) { print; } }
|
|---|