Skip to content

Inconsistent behavior between -mr and -er in v1.9.0 for same regex pattern #2523

Closed

Description

@hnvdie

Description

In httpx v1.9.0, -mr (match regex) does not behave consistently with -er (extract regex) when using the same regex pattern against the same HTTP response.

The same regex is successfully extracted using -er, but -mr does not produce any match.

This behavior is not observed in httpx v1.6.3.


Steps to Reproduce

Test file

key=AKEBOSHI82HAKA123

Start server

python3 -m http.server 8001

httpx v1.6.3 (working behavior)

-mr

echo "http://127.0.0.1:8001/test.txt" | ./httpx-v1.6.3 -mr "AKEBOSHI[0-9A-Z]{6}"
http://127.0.0.1:8001/test.txt

-er

echo "http://127.0.0.1:8001/test.txt" | ./httpx-v1.6.3 -er "AKEBOSHI[0-9A-Z]{6}"
http://127.0.0.1:8001/test.txt [AKEBOSHI82HAKA123]

-mr + -er

echo "http://127.0.0.1:8001/test.txt" | ./httpx-v1.6.3 -mr "AKEBOSHI[0-9A-Z]{6}" -er "AKEBOSHI[0-9A-Z]{6}"
http://127.0.0.1:8001/test.txt [AKEBOSHI82HAKA123]

httpx v1.9.0 (unexpected behavior)

-mr

echo "http://127.0.0.1:8001/test.txt" | ./httpx-v1.9.0 -mr "AKEBOSHI[0-9A-Z]{6}"

(no output)


-er

echo "http://127.0.0.1:8001/test.txt" | ./httpx-v1.9.0 -er "AKEBOSHI[0-9A-Z]{6}"
http://127.0.0.1:8001/test.txt [AKEBOSHI82HAKA123]

-mr + -er

echo "http://127.0.0.1:8001/test.txt" | ./httpx-v1.9.0 -mr "AKEBOSHI[0-9A-Z]{6}" -er "AKEBOSHI[0-9A-Z]{6}"

(no output)


Additional verification

echo "http://127.0.0.1:8001/test.txt" | ./httpx-v1.9.0 -mr "AKEBOSHI"

(no output)

echo "http://127.0.0.1:8001/test.txt" | ./httpx-v1.9.0 -er "AKEBOSHI"
http://127.0.0.1:8001/test.txt [AKEBOSHI82HAKA123]

Expected behavior

If a regex is successfully matched/extracted from the response body, both:

  • -mr should match the response
  • -er should extract the same pattern

Actual behavior

  • -er successfully extracts matches from response body
  • -mr does not match the same regex in v1.9.0
  • Behavior is consistent across regex and literal patterns
  • No issue observed in v1.6.3

Notes

  • Test environment is local (python3 -m http.server)
  • Response body is confirmed valid and clean
  • No encoding issues or hidden characters
  • Fully reproducible on both versions

Activity

  1. added
    Type: Bug
    on Jun 27, 2026
  2. added a commit that references this issue on Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type: Bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions