0

I tried to create a simple snippet that check if there is a 's' and print me the result

${1:s} ${1/(^s$)/(?1yes:no)/}

When there is only an s it should print me "s yes" else it should simply print me for example "notAnS no"

What it actually does is printing me "notAns notAnS" It works well when there is an s

I feel the (?1foo:bar) does not work properly, I read that from https://docs.sublimetext.io/guide/extensibility/snippets.html#substitutions

https://www.boost.org/doc/libs/1_76_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html

Metalucas
  • 1
  • 2
  • 1
    The solution to your problem is to use `${1:s} ${1/(^s$)|(.*)/(?1yes:)(?2:no)/}` though offhand I don't know the subtleties of why that doesn't work the way the documentation says, which could be because of a newer boost version or based on how in a variable substitution like this it runs for every character and not the value as a whole like you might expect. – OdatNurd May 26 '21 at 18:54
  • @OdatNurd It definitely works, Thank you ! – Metalucas May 26 '21 at 19:03

0 Answers0