Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Perl
Perl Misc
I think an assertion might do this?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Jim Gibson, post: 4874658"] Yes, tr can be used as n:1 or 1:0 mappings, not just 1:1. If you want to redo a regular expression from the beginning of the string and keep repeating it until it fails to match, put it in a while loop: while( s/(\n)\n/$1/g ) { ; } However, you have already been given the simplest solution using regexes: s/\n{2,}/\n/g; which fixes your string in one pass, as do all the look-around variations. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Perl
Perl Misc
I think an assertion might do this?
Top