Regular Expressions 101

Quiz_15_Not_surrounded_by_digits

Open Workspace
  • PCRE2 (PHP)
  • Substitution
2

Regular Expression

/
(?<!\d(?=\.\d))\.
/
gi

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