I am rusty on regular expressions and need some help. A js code base inherited is using a mix of camel case and snake casing for things like variables names and object properties.
I am trying to formulate a regular expression I can use that will identify all the camel cased strings, and then be able to replace those strings with snake casing. The part I am struggling with is identifying the camel cased strings under the conditions I have.
Identifying which strings are camel case: In this document, all camel cased strings start off with either a lower case letter, an underscore, or a $, and then will Use a capital Letter at some point later in the string. Examples are: someCamelCasedString
& _someCamelCasedString
& $someCamelCasedString
. The regular expression would need to take into account that some of these strings I am trying to match for may be object properties, so it should be able to identify things like: Foo._someCamelCasedString.bar
or Foo[_someCamelCasedString].bar