Module: WillScanString::RegexpTraits

Defined in:
lib/will_scan_string/regexp_traits.rb

Constant Summary collapse

CAPTURE_GROUP_PATTERN =
/(?<!\\)\((?:\?(?:<([a-z]+)\>|'([a-z]+)')|(?!\?))/i

Instance Method Summary collapse

Instance Method Details

#capture_groupsObject



5
6
7
8
9
10
# File 'lib/will_scan_string/regexp_traits.rb', line 5

def capture_groups
	c = 0
	r = []
	source.scan(CAPTURE_GROUP_PATTERN) { r.push $+.present? ? $+.to_sym : c+=1 }
	r
end