amitk / Coorporatecatering

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

character classes symbol #7

Open amitk opened 7 years ago

amitk commented 7 years ago

=begin Few Character Classes /./ => Any character except a newline /\w/ => A word character => [a-zA-Z0-9] /\W/ => A non-word character => [^a-zA-Z0-9] /\d/ - A digit character => [0-9] /\D/ - A non-digit character => [^0-9] /\h/ - A hexdigit character => [0-9a-fA-F] /\H/ - A non-hexdigit character => [^0-9a-fA-F] /\s/ - A whitespace character: => [ \t\r\n\f] /\S/ - A non-whitespace character: => [^ \t\r\n\f]

=end

p /./ =~ "\nregex" p /[\n]/ =~ "regex" p /\w/ =~ "09777" p /\W/ =~ "09777" p /\d/ =~ "asfdsf" p /\D/ =~ "fadfsdf" p /\h/ =~ "kjdf" p /\H/ =~ "kjdf" p /\s/ =~ "\nhkjh" p /\S/ =~ "\nhkjh"

mohitpm commented 7 years ago

:+1: