Reputation: 204
I have to following regex:
(\/\*\*)([\s[:graph:]]*@brief[\s[:graph:]]*\r)( \*\/)
and I'm trying to check for the following:
/**
@brief TestViewController
<##full description#>
@see UIViewController
@ingroup <##group/module#>
@date 2012-10-29
*/
@interface LaunchViewController : UIViewController {
which is in code variable.
It will not match, checking this way:
if @code =~ /(/*\*)([\s[:graph:]]*@brief[\s[:graph:]]*\r)( \*\)/
puts "found----------"
end
and I also tried it that way:
r = Regexp.new(Regexp.quote('/') + Regexp.quote('**') + '[\s[:graph:]]*@brief[\s[:graph:]]*\r ' + Regexp.quote('*/'))
Can anyone help me please fixing this?
In this case I'm not interested in groups so please do not wonder about the one having groups and the other one with none.
Upvotes: 1
Views: 100
Reputation: 46667
Ruby doesn't usually include \r
in linebreaks. If you change the regexp to:
/(\/\*\*)([\s[:graph:]]*@brief[\s[:graph:]]*)( \*\/)/
I get a match.
Upvotes: 2