0

I have been trying unsuccessfully to mirror text that only matches "a-z0-9" using the following code:

${1/[a-z]/$0/}${1}

After the snippet has been tab triggered I would expect to type "$test" and see "test" mirrored.

Any clues? Many thanks!

Alan Moore
  • 73,866
  • 12
  • 100
  • 156
Chris Kempson
  • 319
  • 1
  • 3
  • 13

1 Answers1

0

The snippet beneath removes all $, % and ? from either beginning or end of your text. Note that the regular expression is added and applied to the mirror, not to the input itself.

$1 ${1/[\$\?%]*([^\$\?%]*)[\$\?%]*/$1/} $0

If you want to exclude more characters, add those to each class (escape them if necessary).

Florian Pilz
  • 8,002
  • 4
  • 22
  • 30