-4

I want to change

template_name = ('front/html_20230713/smp/something.html')

to

template_name = 'front/html_20230713/{request.device}/something.html'

using Ctrl + F and a regular expression.

How can I do that?

I tried to use a regular expression, but it's difficult.

How can I use a regular expression in Visual Studio Code to find-and-replace a string?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
dudu
  • 13
  • 2
  • 1
    What have you tried so far? – Klaus D. Aug 22 '23 at 09:15
  • @Dimitar I wouldn't say so; ChatGPT is by no means a regex expert. – InSync Aug 22 '23 at 12:38
  • 1
    @InSync I've used it to write some pretty complex regex recently. – Dimitar Aug 22 '23 at 13:33
  • 1
    @Dimitar That doesn't mean it is "*basically able to write all kinds of regex*". Try asking for, say, a Java 8 regex that matches `aa...bbbb...` where the number of `b`s is two times greater than that of `a`s. I doubt that it could write something close to [this](https://stackoverflow.com/a/3644267). – InSync Aug 22 '23 at 13:37
  • Ah, I should go ask the gpt right away Oh, I never thought of that. – dudu Aug 22 '23 at 15:48

0 Answers0