Get word under mouse pointer

前端 未结 1 1775
时光说笑
时光说笑 2021-01-25 06:38

according this (get a word under cursor using JavaScript )link i can get word under mouse pointer.it\'s fine for english language. i change it (for arabic language)



        
1条回答
  •  礼貌的吻别
    2021-01-25 07:01

    You need the parentheses that appear in the original regular expression. In regular expression notation, parentheses form a "match group" which is substituted in for the "$1" in the replace string.

    $this.html($this.text().replace(/([^\x00-\x80]+)/g, "$1"));
    

    Without any match groups in your regex, the $1 is simply treated as a literal dollar sign and one.

    When you have multiple parenthesized match groups, the groups are used in to replace dollar-sign-denoted numbered placeholders in the order that the match groups are opened (the first match group replaces $1, the second replaces $2, etc).

    0 讨论(0)
提交回复
热议问题