Page MenuHomeDevCentral

Declare regular expression patterns as raw Python strings
ClosedPublic

Authored by dereckson on Sat, Jul 4, 12:09.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jul 25, 00:48
Unknown Object (File)
Fri, Jul 24, 18:22
Unknown Object (File)
Fri, Jul 24, 02:10
Unknown Object (File)
Thu, Jul 23, 13:46
Unknown Object (File)
Thu, Jul 16, 00:01
Unknown Object (File)
Wed, Jul 15, 16:01
Unknown Object (File)
Wed, Jul 15, 14:48
Unknown Object (File)
Wed, Jul 15, 11:59
Subscribers
None

Details

Summary

This follow current Python style best practice when no escape
is needed, and avoid a syntax warning when the string escapes
a character only to be escaped for regexp, not for Python strings.

Fixes the following issue on Python 3.12+:

/usr/local/bin/shell:138: SyntaxWarning: invalid escape sequence '\|'
  matches = re.search("(.*)\|(.*)", variable)

Diff Detail

Repository
rOPS Nasqueron Operations
Lint
Lint Passed
Unit
No Test Coverage
Branch
main
Build Status
Buildable 6723
Build 7011: arc lint + arc unit

Event Timeline

dereckson created this revision.
dereckson edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Sat, Jul 4, 12:14