I am trying to parse a document that consists of many sections.
Each section begins with :[]:
followed by blank space, followed by 1 or more characters (any characters), followed by a :
a blank space and one or more characters (any characters).
Here's an example:
:[]: Abet1, Abetted34: Find the usage in table under section 1-CB-45: Or more info from the related section starting with PARTIE-DU-CORPS.
:[]: Ou est-ce que tu a mal: Tu as mal aux jambes: Find usage in section 145-TT-LA-TETE.
The token of interest from each section is everything from :[]:
to the first occurrence of :
. For example, in the first section, I am only interested in extracting: :[]: Abet1, Abetted34:
At first, I used the following pattern finder to extract the token from each section of the document but this extracted everything from the first occurrence of :
to the last occurrence of :
in the section:
"\\B:\\[\\]:.*:\\B"
If I change the pattern finder to the following to extract the token from :[]:
to the first occurrence of :
, I get no match:
"\\B:\\[\\]:\\s*.:{1}"
How would the regular expression that extracts what I want look like?