I am parsing Java source code using Python. I need to extract the comment text from the source. I have tried the following.
Take 1:
cmts = re.findall(r'/\*\*(.|[\r\n])*?\*/', lines)
Returns: blanks [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']
Take 2: (added a grouping bracket around the regex)
cmts = re.findall(r'(/\*\*(.|[\r\n])*?\*/)', lines)
Returns
Single line comment (example only):
('/**\n\n * initialise the tag with the colors and the tag name\n\n */', ' ')
Multi line comment (example only):
('/**\n\n * Get the color related to a specified tag\n\n * @param tag the tag that we want to get the colour for\n\n * @return color of the tag in String\n\n */', ' ')
I am interested only in initialise the tag with the colors and the tag name
or Get the color related to a specified tag, @param tag the tag that we want to get the colour for, @return color of the tag in String
and am not able to get my head around it. Please give me some pointers!