Skip to content

Conversation

@azryve
Copy link
Contributor

@azryve azryve commented Sep 15, 2025

Accept any variation b4com, B4com, B4Com, B4COM, etc.

Also remove lookbehind match (repeating B4com prefix).

Also remove '.*' tail match - it would forbid to add model deviations, ie hw.B4com.CS2148P.XXX

@azryve azryve mentioned this pull request Sep 15, 2025
Accept any variation b4com, B4com, B4Com, B4COM, etc.

Also remove lookbehind match (repeating B4com prefix).

Also remove '.*' tail match - it would forbid to add module deviations, ie hw.B4com.CS2148P.XXX
@azryve azryve force-pushed the fix/b4com-case-insensitive branch from 5d48679 to a0f8a41 Compare September 15, 2025 08:29
"B4com.CS4132U": "^[Bb]4com B4T-CS4132U.*",
"B4com.CS4148Q": "^[Bb]4com B4T-CS4148Q.*",
"B4com.CS4164U": "^[Bb]4com B4T-CS4164U.*"
"B4com": "^[Bb]4[Cc][Oo][Mm]",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"B4com": "^[Bb]4[Cc][Oo][Mm]",
"B4com": "^(?i:B4com)",
>>> re.match(r'^(?i:B4com)', 'B4COM')
<re.Match object; span=(0, 5), match='B4COM'>
>>> re.match(r'^(?i:B4com)', 'b4com')
<re.Match object; span=(0, 5), match='b4com'>

https://docs.python.org/3/library/re.html#index-17

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am hesitant of using inline flags here becase of https://bugs.python.org/issue39394

Is ok here since its in the begginging and local (?i:...) but I am afraid someone will copy-paste it and do not close brackets:

>>> re.compile("(?i)xxx")
re.compile('(?i)xxx', re.IGNORECASE)
>>>
>>> re.compile("xxx(?i:xxx)")
re.compile('xxx(?i:xxx)')
>>>
>>> re.compile("xxx(?i)xxx")
Traceback (most recent call last):
  ...
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/re/_parser.py", line 840, in _parse
    raise source.error('global flags not at the start '
re.error: global flags not at the start of the expression at position 3

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.

3 participants