몇 가지 구조체 정의가 포함 된 헤더 파일이 있습니다. 이 파일에서 spesific 구조체를 추출하고 싶습니다. 예를 들어 두 번째 구조체 만 가져와야합니다. 표현 아래중복 된 패턴을 분리하는 방법
typedef struct {
int a;
int b;
} first;
typedef struct {
int x;
int y;
} second;
...
headerText = headerFile.read()
re.match(r"typedef struct {(.*)} second;", headerText)
...
반환
int a;
int b;
} first;
typedef struct {
int x;
int y;
어떻게에만 두 번째 구조체를 얻을 수 있나요? 감사합니다 ...
[욕심이 아닌'. *?'] (http://www.regular-expressions.info/repeat.html) – Bergi
@Bergi 그럴 이유가 없습니다. – Anirudha
언어를 지정해야합니다. – Anirudha