Flagsmith / Flagsmith/flagsmith

RegEx for Segment Naming

Open
#8,155 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6.6k
Forks
567
Avg merge
1d 13h
Merged PRs (30d)
121

Description

### Is your feature request related to a problem?

This is not related to a bug, this is an enhancement request.

### Describe the solution you'd like.

I'd like to be able to enforce segment naming conventions using _regular expressions_. Ideally, it would work in the manner that regular expressions are being used to enforce feature naming.

Regular expressions for segment naming would provide business value
- **Reduced manual configuration**: Eliminate need to create individual segments for each environment/team variant
- **Improved scalability**: Support enterprise rollout across different teams
- **Consistency**: Enforce organizational naming standards through pattern matching
- **Efficiency**: Streamline onboarding of new teams and applications

### Acceptance Criteria
AC1 – Administrator can configure a segment naming regex
Given I am an administrator with permission to manage naming policies
When I navigate to the naming convention settings
Then I can define and save a regular expression that will be used to validate segment names.

AC2 – Segment names are validated during creation
Given a segment naming regex has been configured
When a user creates a new segment
Then the system validates the segment name against the configured regex
And only allows creation if the name matches the pattern.

AC3 – Segment names are validated during updates
Given a segment naming regex has been configured
When a user renames an existing segment
Then the system validates the updated name against the configured regex
And prevents the update if the name does not match the pattern.

AC4 – Users receive clear validation feedback
Given a user enters a segment name that does not satisfy the configured regex
When validation occurs
Then the user is shown a clear error message indicating the name is invalid
And the message includes the expected naming format or pattern description.
Example message:
"Segment names must follow the format -- (e.g., dx-prod-reporting)."

### Describe alternatives you've considered

Manual enforcement is one option. This option works, and is what we use, but involves a bit of guesswork (what is the convention?)

### Additional context

Thank you! This is related to jonathon_moorman@onecallcm.com (One Call) but that user name is unable to create a issue.

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Start by locating the naming convention settings and the segment creation and rename validation paths, then trace how validation errors are shown. Done means the acceptance criteria work for configuration, creation, updates, and clear feedback.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
full-stack
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.