Net class net pattern confusion

Does the net class net pattern system use regular expressions, or not, or sometimes?

In the EESchema docs, near:

https://docs.kicad.org/8.0/en/eeschema/eeschema_schematic_creation_and_editing.html#schematic-setup-netclasses

there’s this discussion:

Net patterns can use both wildcards (* to match any number of any characters, including none, and ? to match any character) and regular expressions. The nets that match the selected pattern are displayed to the right of the pattern list.

For example, the net* pattern matches nets named net, net1, network, and any other net name beginning with net. Because * has a slightly different meaning in a regular expression (* matches zero or more of the preceding character), the net* pattern would also match a net named ne.

This seems… either incorrectly documented, or crazy design. Surely matching would implement either “DOS wildcards” behavior for * and ?, OR implement regex, but not a hodge-podge. If both behaviors were offered, then surely it would require some switch to select between them?

Otherwise this would result in high risk of errors. In general, if you want to group (“class-ify”) a bunch of anything by prefix, you specifically DON’T want any shorter name to match.

Like if your schematic has plain “GND”, but also specialized “GND_A”, “GND_B3” and so on, which you might pattern as “GND_*”, you specifically don’t want this pattern to match plain “GND”, which the doc seems to permit. Slightly contrived example, but hopefully conveys the point.

So am I understanding this worng, or ???

The documentation is correct and you are correct that a given net class pattern can match both regex and wildcard with the same pattern. I personally agree that this is frustrating design. There is a gitlab issue here to individually enabled or disable the types of pattern matching. Consider giving the issue a “thumbs up” on gitlab to show support. While popularity does not guarantee that a specific issue will be worked on by a volunteer, it certainly doesn’t hurt.

Issue link: [Feature Request]: Netclass Assignments: Patterns — Individual Search Method Enable/Disable (#14321) · Issues · KiCad / KiCad Source Code / kicad · GitLab

Thanks for your reply – I have added a vote and comment to the issue you pointed to.