Hacker News new | ask | show | jobs
by catchmeifyoucan 1137 days ago
Loving the new Code Search! Might be super specific, but is there any syntax for searching attributes in HTML elements. For example if a React Component called <Button ...some-props color="red" /> what's the best way to find all the buttons that are red?
1 comments

Hmm, you can construct a regular expression, something like:

    lang:tsx /<Button[^\\].\* color="red"/
Example:

https://github.com/search?q=lang%3Atsx+%2F%3CButton%5B%5E%5C...

You can do code blocks with 4 consecutive spaces. Backticks are not supported unfortunately
Ooh nice, this looks great! Thanks!!