HomeRegex LibraryCamelCase Word Boundary Regex
100% Client-Side β€’ 0 B Data Leaves Browser
formatting

CamelCase Word Boundary Regex

Identifies transitional word boundaries in camelCase and PascalCase identifiers to convert strings into snake_case or kebab-case.

Regular Expression Pattern:
/([a-z0-9])([A-Z])/g
Valid Match Example:
devTransformHub
Invalid / Non-Match Example:
lowercase

Regex Syntax Breakdown & Explanation

  • β€’([a-z0-9]) : Captures preceding lowercase letter or digit
  • β€’([A-Z]) : Captures subsequent uppercase letter initiating new word

Implementation in Popular Languages

JavaScript / TypeScript
const regex = /([a-z0-9])([A-Z])/g;
const isValid = regex.test("devTransformHub");
console.log(isValid); // true
Python (re)
import re

pattern = r"([a-z0-9])([A-Z])"
match = re.match(pattern, "devTransformHub")
print(bool(match)) # True
Go (regexp)
package main
import (
  "fmt"
  "regexp"
)

func main() {
  re := regexp.MustCompile(`([a-z0-9])([A-Z])`)
  fmt.Println(re.MatchString("devTransformHub"))
}
Frequently Asked Questions

Frequently Asked Questions

Everything you need to know regarding specifications, syntax, and security best practices.

The regular expression pattern is /([a-z0-9])([A-Z])/g. Identifies transitional word boundaries in camelCase and PascalCase identifiers to convert strings into snake_case or kebab-case.