Regular expressions and text guides

Case conversion: acronyms, separators and identifier rules

Convert naming styles while checking acronym boundaries and target-language identifier validity.

Nav Tools ·

Define word boundaries

Case conversion needs a rule for splitting acronyms and transitions between lowercase and uppercase letters.

Nav Tools splits an acronym before a following capitalized word, then lowercases the pieces for snake, kebab and camel styles.

HTTPServerID → http_server_id (snake)
HTTPServerID → httpServerId (camel)

Expect acronym spelling to change

Camel case may turn ID into Id after a boundary split. Some project conventions prefer preserving ID or URL in specific positions.

Compare the tool result with your repository naming convention before performing a batch rename. Mechanical conversion cannot infer that convention.

Validate the resulting identifier

A readable converted string may still begin with a digit or match a reserved word. A kebab-case name is not a JavaScript variable identifier.

Apply the target language's identifier and keyword checks after conversion. Use bracket access for arbitrary JSON keys when appropriate.

user-name: suitable for a slug
obj['user-name']: valid property access
let user-name: not a valid declaration

Treat renaming as a contract change

Changing an API field from user_id to userId changes the wire contract even if application variables use camel case.

Keep explicit serializer mappings and test both directions. Display formatting alone should not rewrite external field names.

References

← Regular expressions and text guides