Regular Expressions 101

Community Patterns

Community Library Entry

2

Regular Expression
Created·2024-10-08 14:01
Flavor·PCRE2 (PHP)

/
(?<!\d(?=\.\d))\.
/
gi
Open regex in editor

Description

Replace every . (dot) with a - (hyphen) except when the dot is surrounded by digits. E.g.: .a.b.1.2. should become -a-b-1.2-

Submitted by anonymous