Be able to use regex in interface bulk renaming #1634

Closed
opened 2025-12-29 16:33:41 +01:00 by adam · 0 comments
Owner

Originally created by @matthieugouel on GitHub (Mar 21, 2018).

Issue type

[X] Feature request
[ ] Bug report
[ ] Documentation

Environment

  • Python version: 3.6
  • NetBox version: 2.3.1

Description

Hi !
I'm currently using interface bulk renaming implemented in v2.3.0 in order to rename stack / module interfaces easily from the IHM. Currently it seems to use replace() string built-in function to do the find / replace processing.

It does the work very well most of the time but it has some limitations. For instance, let's say you have interfaces noted with numbers only (1, 2, 3, ...) and you want to replace that with (1/1, 1/2, 1/3, ...). For this particular case I don't think it's actually possible.

I would suggest to use re.sub() function to do the find / replace processing. It would not change the current use, but it would add the possibility to do something like :

Find : (\d+)
Replace : 1/\1

If that feature request is accepted I would be happy to do a pull request with that little modification.

Have a good day,
Matthieu.

Originally created by @matthieugouel on GitHub (Mar 21, 2018). <!-- Before opening a new issue, please search through the existing issues to see if your topic has already been addressed. Note that you may need to remove the "is:open" filter from the search bar to include closed issues. Check the appropriate type for your issue below by placing an x between the brackets. For assistance with installation issues, or for any other issues other than those listed below, please raise your topic for discussion on our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please note that issues which do not fall under any of the below categories will be closed. Due to an excessive backlog of feature requests, we are not currently accepting any proposals which extend NetBox's feature scope. Do not prepend any sort of tag to your issue's title. An administrator will review your issue and assign labels as appropriate. ---> ### Issue type [X] Feature request <!-- An enhancement of existing functionality --> [ ] Bug report <!-- Unexpected or erroneous behavior --> [ ] Documentation <!-- A modification to the documentation --> <!-- Please describe the environment in which you are running NetBox. (Be sure to verify that you are running the latest stable release of NetBox before submitting a bug report.) If you are submitting a bug report and have made any changes to the code base, please first validate that your bug can be recreated while running an official release. --> ### Environment * Python version: <!-- Example: 3.5.4 --> 3.6 * NetBox version: <!-- Example: 2.1.3 --> 2.3.1 <!-- BUG REPORTS must include: * A list of the steps needed for someone else to reproduce the bug * A description of the expected and observed behavior * Any relevant error messages (screenshots may also help) FEATURE REQUESTS must include: * A detailed description of the proposed functionality * A use case for the new feature * A rough description of any necessary changes to the database schema * Any relevant third-party libraries which would be needed --> ### Description Hi ! I'm currently using interface bulk renaming implemented in v2.3.0 in order to rename stack / module interfaces easily from the IHM. Currently it seems to use `replace()` string built-in function to do the find / replace processing. It does the work very well most of the time but it has some limitations. For instance, let's say you have interfaces noted with numbers only (1, 2, 3, ...) and you want to replace that with (1/1, 1/2, 1/3, ...). For this particular case I don't think it's actually possible. I would suggest to use `re.sub()` function to do the find / replace processing. It would not change the current use, but it would add the possibility to do something like : ``` Find : (\d+) Replace : 1/\1 ``` If that feature request is accepted I would be happy to do a pull request with that little modification. Have a good day, Matthieu.
adam added the status: acceptedtype: feature labels 2025-12-29 16:33:41 +01:00
adam closed this issue 2025-12-29 16:33:42 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1634