How to remove dollar format with regex

前端 未结 8 2005
北荒
北荒 2021-01-21 02:42

I am trying to remove the dollar format from the string \'$1,109,889.23\'. I tried using a regular expression with:

\"[^\\\\d]\" 

but then I ge

8条回答
  •  無奈伤痛
    2021-01-21 03:05

    Since $ is a metacharacter in regex (it means "end of string" or "end of line", depending on the current settings), it needs to be escaped to \$. But why use a regex at all if it's just one fixed character?

提交回复
热议问题