question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

folding template strings

See original GitHub issue

The default regex will not handle things like

<div className={`p-1 ${big ? "mt-6" : "mt-0"}`}>

Anyway to handle this nicely?

I tried combining a “string regex” with a “template string” regex unforunately that puts the relevant result of the second regex in group 5 instead of group 2 as the first.

see my attempt here

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:29 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
moalamricommented, Jul 27, 2022

@e-medeiros thanks for testing 😃 The problem with react syntax is that it can have any attribute value as there’s no compiler to parse the value. It’s just the browser engine that renders the value as it is, and you can basically concat anything. In this case you will have to make the regex greedy, but that means any following attribute will be matched as well. When you make the regex lazy then it will stop when it encounter any of ending characters.

I will have some time next week to look into away to workaround this.

1reaction
e-medeiroscommented, Jul 27, 2022

@moalamri worked fine with 0.1.5

Read more comments on GitHub >

github_iconTop Results From Across the Web

Template Strings - TypeScript Deep Dive - Gitbook
The motivation of Template Literals is three fold: String Interpolation. Multiline Strings ... They have since been officially renamed to template literals.
Read more >
ES6 template string codes folded wanted! #57124 - GitHub
ES6 template string codes folded wanted!
Read more >
Template strings in F#? - Stack Overflow
If you have a dynamic list of substitutions, you can achieve what Template() does with a simple fold: let substitutions = [("who", "tim");...
Read more >
Template literals (Template strings) - JavaScript | MDN
Template literals are literals delimited with backtick (`) characters, allowing for multi-line strings, string interpolation with embedded ...
Read more >
JavaScript Template Strings - David Walsh Blog
Seemingly every language has a template string enhancement, and within JavaScript we've written our own to ... CSS 3D Folding Animation.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found