* Revert "Account for empty string regexp in lineinfile (#41451)"
This reverts commit 4b5b4a760c.
* Use context managers for interacting with files
* Store line and regexp parameters in a variable
* Add warning when regexp is an empty string
* Remove '=' from error messages
* Update warning message and add changelog
* Add tests
* Improve warning message
Offer an equivalent regexp that won't trigger the warning.
Update tests to match new warning.
* Add porting guide entry for lineinfile change
* Use context managers for interacting with files
* Account for empty string as regexp
Rather than explicitly testing for None, also test for an empty string which will evaluate to False. An empty string regexp matches every line, which ends up replacing the incorrect line.
* Store line parameter in a variable
* Add tests
If a line match is found in the file and no regexp is specified, insertbefore would improperly try to add a line if set to BOF.
Add tests for this scenario.
* Insert lines before or after when the regexp exists elsewhere in the file
* Correct filter syntax in lineinfile integration test
* Use multi-line YAML syntax on lineinfile tests
Unify indentation
* Add lineinfile tests for same line matched to different regexps
* Remove debug statement from test