lepuNameMatch
Builds a matcher for one advertised name that cannot also match a longer one.
The vendor tests these names with a substring check in a hand-ordered cascade, so BP2
only fails to match a BP2W because BP2W happens to be checked first. Order is a fragile
place to keep a safety property: it lives in whoever wrote the list, is invisible at the
point of use, and an insertion in the wrong place silently binds the wrong driver.
Here the exclusions are derived instead. Every name in the vocabulary that extends this one becomes a negative lookahead, so the matcher is correct wherever it is used and in whatever order it is tried.
The match is deliberately open at the end, because these devices advertise a serial after
the model - BP2 1234 - and the serial's shape varies across the family.
Kind: Function
Package: @ovok/native
Import
import { lepuNameMatch } from '@ovok/native/bt-management';
TypeScript signatures
(name: string, vocabulary?: readonly string[]): RegExp
| Parameter | Type | Details |
|---|---|---|
name | string | — |
vocabulary | readonly string[] | — |
Returns: RegExp.
Learn the workflow
Continue with Bluetooth for the workflow context and examples.