I have a text file of several hundreds of terms in the following format:
[Term]
id: id1
name: name1
xref: type1:aab
xref: type2:cdc
[Term]
id: id2
name: name2
xref: type1:aba
xref: type3:fee
I need to extract all terms with an xref of type1 and write them to a new file in the same format. I was planning to use a regular expression like this:
/\[Term\](.*)type1(.*)[^\[Term\]]/g
to find the corresponding terms but I don't know how to search for a regex over multiple lines. Should I read the original text file as a string or rather line for line? Any help would be very much appreciated.