Steps to replicate the issue (include links if applicable):
- Create test.less with the following contents:
@inputList: 'foo bar baz'; @transformed1: replace( @inputList, '(^| )([^ ]+)', '($2)', 'g'); @transformed2: replace( @inputList, '(^| )([^ ]+)', 'begin $2 end ', 'g'); @selector: e( replace( @inputList, '(^| )([^ ]+)', ':not( :lang( $2 ) )', 'g' ) ); .foo { content: '@{transformed1}'; content: '@{transformed2}'; &@{selector} { filter: invert(1); } }
- Run ./bin/lessc test.less
What happens?:
The following output is produced:
.foo { content: '((foo))(bar)(baz)'; content: 'begin begin end begin foo end begin end end begin bar end begin baz end '; } .foo:not( :lang( :not( ) ):not( :lang( :lang( ) ):not( :lang( foo ) ):not( :lang( ) ) ):not( :lang( ) ) ):not( :lang( bar ) ):not( :lang( baz ) ) { filter: invert(1); }
Note that the replacement around "foo" introduces excessive output in all three cases, but the nature of the excessive output differs: the first line starts with ((foo)), but the second line starts with begin begin end begin foo end begin end end which is equivalent to (()(foo)())
What should have happened instead?:
Version 4.1.1 produces the correct output, which is:
.foo { content: '(foo)(bar)(baz)'; content: 'begin foo end begin bar end begin baz end '; } .foo:not( :lang( foo ) ):not( :lang( bar ) ):not( :lang( baz ) ) { filter: invert(1); }
Software version: Less.php 4.2.1 has the bug, but 4.1.1 behaves correctly