[PR #1643] [MERGED] Implements #1586, add additional variants for ExpandableNameFields #12237

Closed
opened 2025-12-29 22:20:25 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/1643
Author: @RyanBreaker
Created: 10/25/2017
Status: Merged
Merged: 3/22/2018
Merged by: @jeremystretch

Base: developHead: wildcard


📝 Commits (10+)

  • 3d91153 Add alphabetic variants to interface expansions
  • c107f35 Merge letters and numbers into one function
  • b295849 Prevent mismatch of types in ranges
  • 3df7e28 Prevent mismatch of cases in ranges
  • 33a9944 Update help text for ExpandableNameField
  • 1a6ee23 Update help text for ExpandableNameField (again)
  • 53f58d4 Update comment
  • 3d02312 Refactor pattern check
  • e57b8aa E226 fix
  • 57973f6 Fix bug with numbers >10

📊 Changes

1 file changed (+47 additions, -4 deletions)

View changed files

📝 netbox/utilities/forms.py (+47 -4)

📄 Description

Fixes:

#1586: When creating Interfaces, allow more wildcard variants

Adds the availability for using alphanumeric characters instead of just numeric characters for ExpandableNameFields. This adds to the available characters available for use in expansions from just [0-9] to [a-zA-Z0-9] (or the regex equivalent of \w without _).

Mixing of types (numeric or alphabetic) or cases (uppercase or lowercase) within the same range is not allowed and is prevented.

Examples of what's allowed:

[0-2,a-c,A-C] => 0, 1, 2, a, b, c, A, B, C
[0-2][a-b] => 0a, 0b, 1a, 1b, 2a, 2b

Examples of what's not allowed and is prevented:

[0-a]
[A-z]

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/1643 **Author:** [@RyanBreaker](https://github.com/RyanBreaker) **Created:** 10/25/2017 **Status:** ✅ Merged **Merged:** 3/22/2018 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `wildcard` --- ### 📝 Commits (10+) - [`3d91153`](https://github.com/netbox-community/netbox/commit/3d911532756a37a9b3f501a207d8afe0c56184cd) Add alphabetic variants to interface expansions - [`c107f35`](https://github.com/netbox-community/netbox/commit/c107f35118778aadd1cfdaf514425343d66611ef) Merge letters and numbers into one function - [`b295849`](https://github.com/netbox-community/netbox/commit/b295849f536e06eba6a40d6288f373d3839ce51e) Prevent mismatch of types in ranges - [`3df7e28`](https://github.com/netbox-community/netbox/commit/3df7e283e38d9fee7ca5a450599e5b6fca9d284e) Prevent mismatch of cases in ranges - [`33a9944`](https://github.com/netbox-community/netbox/commit/33a99441a48dad31e3115798e03e49b503cdb279) Update help text for ExpandableNameField - [`1a6ee23`](https://github.com/netbox-community/netbox/commit/1a6ee237f6ce71eb52c8804d31b3f15c63f153b3) Update help text for ExpandableNameField (again) - [`53f58d4`](https://github.com/netbox-community/netbox/commit/53f58d4496668a54484346e5efb2e0ae6fa894ac) Update comment - [`3d02312`](https://github.com/netbox-community/netbox/commit/3d023126bad51a0d058fb82c22d6f4fb73b65d6a) Refactor pattern check - [`e57b8aa`](https://github.com/netbox-community/netbox/commit/e57b8aa26f8389f6107d017d4c8e5aea9e2663fa) E226 fix - [`57973f6`](https://github.com/netbox-community/netbox/commit/57973f62c5b31ac235141de0f9c18a5aeaf8ed1a) Fix bug with numbers >10 ### 📊 Changes **1 file changed** (+47 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `netbox/utilities/forms.py` (+47 -4) </details> ### 📄 Description <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be opened for approval prior to filing a pull request. This helps avoid wasting time and effort on something that we might not be able to accept. Please indicate the relevant feature request or bug report below. --> ### Fixes: #1586: When creating Interfaces, allow more wildcard variants <!-- Please include a summary of the proposed changes below. --> Adds the availability for using alphanumeric characters instead of just numeric characters for ExpandableNameFields. This adds to the available characters available for use in expansions from just `[0-9]` to `[a-zA-Z0-9]` (or the regex equivalent of `\w` without `_`). Mixing of types (numeric or alphabetic) or cases (uppercase or lowercase) within the same range is not allowed and is prevented. Examples of what's allowed: ```nohighlight [0-2,a-c,A-C] => 0, 1, 2, a, b, c, A, B, C [0-2][a-b] => 0a, 0b, 1a, 1b, 2a, 2b ``` Examples of what's **not** allowed and is prevented: ```nohighlight [0-a] [A-z] ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 22:20:25 +01:00
adam closed this issue 2025-12-29 22:20:25 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#12237