How to escape dollar sign ($) in a string using perl regex

Try this: my %special_characters; $special_characters{“_”} = “\\_”; $special_characters{“\\\$”} = “\\\$”; $special_characters{“{“} = “\\{“; $special_characters{“}”} = “\\}”; $special_characters{“#”} = “\\#”; $special_characters{“%”} = “\\%”; $special_characters{“&”} = “\\&”; Looks weird, right? Your regex needs to look as follows: s/\$/\$/g In the first part of the regex, “$” needs to be escaped, because it’s a special regex character denoting … Read more

$ Variable (Dollar Sign) in Chrome?

This has changed yet again, even since just last year. The devtools console provides $ as an alias to document.querySelector, along with many other things; here’s an excerpted list: $(selector) returns the reference to the first DOM element with the specified CSS selector. This function is an alias for the document.querySelector() function. $$(selector) returns an … Read more