amitk / Coorporatecatering

A ruby on rails learning project
0 stars 0 forks source link

character classes #6

Open amitk opened 7 years ago

amitk commented 7 years ago

=begin Character Classes delimited with square brackets ([, ]) diff between /[ab]/ and /ab/ hyphen (-) is a metacharacter denoting an inclusive range. => [abcd] = [a-d] => [abcdwxyz] = [a-dw-z] (order does not matters) caret (^) the class is inverted

p /[ab]/ =~ "rails" p /[a-d]/ =~ "god" p /[^abc]/ =~ "money" p /[ab^c]/ =~ "r ^ugby"

mohitpm commented 7 years ago

:+1: