When replacing a string with a string, that includes the search, it will lead to an endless loop in JOrphanUtils#replaceAllWithRegex. A simple testcase can be constructed using a ThreadGroup containing a HTTP Sampler with a Parameter having a key "name" and a value "abc". Now, if try a find replace with "abc" as the search and "abcabc" as the replacement, "replace all" will never come to a halt :(
Created attachment 34963 [details] Don't replace the matcher Instead of replacing the matcher and using replaceFirst, take appendReplacement on the one and only matcher.
Will be included in version 3.3. Date: Sat Apr 29 12:18:36 2017 New Revision: 1793191 URL: http://svn.apache.org/viewvc?rev=1793191&view=rev Log: Endless loop in JOrphanUtils#replaceAllWithRegex when regex is contained in replacement Bugzilla Id: 61054 Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java jmeter/trunk/test/src/org/apache/jorphan/util/TestJorphanUtils.java jmeter/trunk/xdocs/changes.xml
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/4380