Skip to content

use raw string to escape regex sequence#129

Open
adehad wants to merge 1 commit into
scientifichackers:masterfrom
adehad:patch-1
Open

use raw string to escape regex sequence#129
adehad wants to merge 1 commit into
scientifichackers:masterfrom
adehad:patch-1

Conversation

@adehad
Copy link
Copy Markdown

@adehad adehad commented May 16, 2025

This addresses the SyntaxWarning for 'invalid escape sequence'

For example in a Python REPL or otherwise:

import re

>>> match1 = re.match(r"^COM(\d+)$", "COM124")
>>> match1.group()
'COM124'
>>> match2 = re.match("^COM(\d+)$", "COM123")
<stdin>:1: SyntaxWarning: invalid escape sequence '\d'
>>> match2.group()
'COM123'

It appears that at least of Python v3.12.6 it has not resulted in an error. But perhaps worth fixing!

curiouswala added a commit that referenced this pull request Apr 16, 2026
…ADME

- Add ampy/__main__.py so the package can be invoked with python -m ampy
  (PR #121)
- Fix SyntaxWarning: use raw string r"^COM(\d+)$" in windows_full_port_name
  (PR #129)
- Document mkdir, rmdir, and reset commands in README command list,
  align column widths for readability (PR #115)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant