Some regular expressions to use in find and replacer on editors
- Regex: (\w+).(\w+)\s?=\s?(.+)?;
- Replace: $2: $3,
- Ex.: foo.bar = 35; --> bar: 35,
- Regex: function\s(\w+)()\s+?{}
- Replace: const $1 = {};
- Ex.: function Foo() {} --> const Foo = {};
- Regex: const\s(\w+)\s?=\s?((.+))\s?=>\s?{
- Replace: function $1$2 {
- Ex.: const Foo = {} --> function Foo() {};
- Regex: \${(.+?)}
- Replace: " + $1 + "
- Ex.: ${CCToolkit.getServiceUrl()}getimagedatastring?session=${CCToolkit.getSessionId()}&imageID=3 --> " + CCToolkit.getServiceUrl() + "getimagedatastring?session=" + CCToolkit.getSessionId() + "&imageID=3"
- Regex: `(.+?)`
- Replace: "$1"
- Ex.: `tttatsdgsdgdsg` --> "tttatsdgsdgdsg"
- myStr.replace(/${(.+?)}/gi, '" + $1 + "').replace(/`(.+?)`/gi, "$1")