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)
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).