8

I am trying to replace css variables with sass variables.

So, find things like var(--blue500); and replace with $blue500;

But I try find var\(--(.*)\); and replace $$1, the result is $$1.

If I try replace \$$1;, the result is \$1.

If I don't use dollar signs as a test and set the replace to zzzz$1 the result is zzzzblue500

I could do it this way and replace all zzzz with $ in a separate pass, but what am I missing here?

1
  • Side note: Change .* to [^)]* Commented Nov 26, 2019 at 17:24

1 Answer 1

14

You need to escape the $ replacement with $$ and then use the substitution value of $1.

The resulting expression should be: $$$1

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.