I am attempting to scan the following string with the following regular expression:
text = %q{akdce ALASKA DISTRICT COURT CM/ECFalmdce
ALABAMA MIDDLE DISTRICT COURTalndce
}
p courts = text.scan(/(ECF\w+)|(COURT\w+)/)
Ideally, what I want to do is scan the text and pull the text 'ECFalmdce' and 'COURTalndce' With the regex I am using, I am trying to say I want a string that starts with either COURT or ECF followed by a random string of characters.
The array being returned is:
[["ECFalmdce", nil], [nil, "COURTalndce"]]
What is the deal with the nil's, does anyone have a more efficient way of writing the regex, and does anyone have a link to further documentation on match groups?