Skip to content

Have some ways to match a c struct use rg? #2410

Answered by BurntSushi
Lerr1uqs asked this question in Q&A
Discussion options

You must be logged in to vote

When asking a question and say "I tried ..." but don't actually elaborate on what you tried, it makes answering the question much harder.

In any case, this will match the specific input you gave:

$ cat test.c
typedef A{
  int bl;
}B;
$ rg -U 'typedef A\{(?s:.)*?\}.*;' test.c
1:typedef A{
2:  int bl;
3:}B;

But of course, this is not going to match any typedef. Just the one you gave and ones very similar to it.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Lerr1uqs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants