From edd0f388ca2a61943203c4ed11b8933e05296b95 Mon Sep 17 00:00:00 2001 From: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Date: Mon, 23 Jan 2023 22:10:40 +0000 Subject: [PATCH] Fix terminal exit after `--sort p/e` (#4013) * fix scr sort exit * rewrite unit test output * rewind slash replace * rewind slash replace * fix regex * rewrite expected scr tests * black Co-authored-by: James Maslek --- openbb_terminal/stocks/screener/screener_controller.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openbb_terminal/stocks/screener/screener_controller.py b/openbb_terminal/stocks/screener/screener_controller.py index 011ef164d244..05e416269690 100644 --- a/openbb_terminal/stocks/screener/screener_controller.py +++ b/openbb_terminal/stocks/screener/screener_controller.py @@ -92,7 +92,10 @@ def parse_input(self, an_input: str) -> List: See `BaseController.parse_input()` for details. """ # Filtering out sorting parameters with forward slashes like P/E - sort_filter = r"((\ -s |\ --sort ).*?(P\/E|Fwd P\/E|P\/S|P\/B|P\/C|P\/FCF)*)" + f0 = r"(p\/e|fwd p\/e|p\/s|p\/b|p\/c|p\/fcf)" + f1 = r"(P\/E|Fwd P\/E|P\/S|P\/B|P\/C|P\/FCF)" + + sort_filter = r"((\ -s |\ --sort ).*?" + r"(" + f0 + r"|" + f1 + r")" + r"*)" custom_filters = [sort_filter]