grep1-5 Exercise 3: USD Without a Dollar Sign, Other Currencies, and an Error That Is Not 'No Match' ===================================================================================================== cat > prices.txt <<'EOF' Price 100 USD, 250 EUR, 75 USD, $30 USD EOF echo "USD amounts without a dollar sign in front:" grep -oP '(? aaa.txt; echo b >> aaa.txt echo "a repeat inside a repeat (Perl mode):" grep -P '^(a+)+$' aaa.txt; echo "status $?" echo "the same idea written simply:" grep -P '^a+$' aaa.txt; echo "status $?" echo "and in extended mode:" grep -E '^(a+)+$' aaa.txt; echo "status $?" Output: USD amounts without a dollar sign in front: 100 75 amounts in another currency: 250 a repeat inside a repeat (Perl mode): grep: exceeded PCRE's backtracking limit status 2 the same idea written simply: status 1 and in extended mode: status 1 WHY THIS WORKS AS AN ANSWER --------------------------- (?