re = /[\*\s]*@(?P<name>\w+[\\\w]*?)(?:\s|\()
(?P<value>
(?:[\/\w\s\"\<\>\_\#\=\-\.\'\{\}:;,\*\(\)\[\]]*[^\R\*\s\/\)])
)?
(?:\s | $|\))/xm
str = '/**
* Description
*
* @Tag name name @annotation beee @aaf dsfsd fgdg
* @Tag name name {"json":"dfsf"} (sad)
* @Tag asdasd <html> #markdown ==markdown== __markdown__
* - markdown
* > mark 1
.mark
"string"
\'string\'
* @Annotation()
* @Tag name name @annotation beee @aaf dsfsd fgdg <markdown> #markdown ==markdown==
* @a() @b("name") @c()
* @Annotation\\Name("var1()", "var2") @n("name()_name")
* @Annotation(["var1", "var2"], "var3")
* @Annotation\\Filter\\Name(["var1", "var2"], "var3", {"var4": "var5"})
* @Annotation(
* ["GET", "POST"]
) @Name({"name": "Tomas"})
* @Tag name name
*/'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html