N
New C.
How do you get Ruby to print the string that matches a certain regex
pattern.
I need to find a pattern where a small latin letter is has three large
letters on either side.
My code is:
str = "aaaDDDbDDDcDDDgHHyHjHJkkjUUh"
arr = str.scan(/([A-Z])\1{2}[a-z]\1{3}/)
print arr
The match is DDDbDDD but the arr prints only the first letter D.
How do I get it to print the full string ("DDDbDDD")?
pattern.
I need to find a pattern where a small latin letter is has three large
letters on either side.
My code is:
str = "aaaDDDbDDDcDDDgHHyHjHJkkjUUh"
arr = str.scan(/([A-Z])\1{2}[a-z]\1{3}/)
print arr
The match is DDDbDDD but the arr prints only the first letter D.
How do I get it to print the full string ("DDDbDDD")?