So right now I can isolate each JSDoc (ish) block I have in my code, for example I have this block here
/// @tag {type} name description
/// description continue
/// another description line
/// @tag {type} name description
/// description continue
/// @tag name description just one line.
/// @tag {type} name
I want to use a Regex expression to match each tag inside the block a tag needs to have a @name format then it can have a type {type} (optional) then it requires a name and finally it can have a description.. the description can be both multiple lined or single lined (and is also optional). So
the Regex I have came up with was:
^\/{3} @(?<tag>\w+)(?:[ \t]+{(?<type>.*)})?(?:[ \t]+(?<name>\w+))(?:[ \t]+(?<desc>[\s\S]*))?
my problem is with the description as soon as I hit the description it doesn't stop at the start of the next tag... I get the feeling that right now I'm using a greedy approach but I cannot find a wait to make it non greedy.
So the example above matches:
tag: tag
name: name
description:
description
/// description continue
/// another description line
/// @tag {type} name description
/// description continue
/// @tag name description just one line.
/// @tag {type} name
I wanted the description to stop just as the new tag starts or if the block ends