Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
([a-zA-Z0-9\_]*)\:\s?([A-Za-z0-9\"\']*)
/
mg

Description

This will allow you to swap key and value in a JavaScript object. So { language: "romanian" } will become { romanian: "language" }

Submitted by Victor - 9 years ago