Documention for: regset.r Created by: rebolek on: 31-May-2007 Last updated by: rebolek on: 31-May-2007 Format: text/editable Downloaded on: 28-Mar-2024 REGSET.r Boleslav Brezovsky 31-5-2007 ===Introduction %regset.r is part of R2E2 - REBOL Regular Expressions Engine. Purpose of 'regset is to convert small bit of regex to bitset! 'regset can handle regex' groups (everything in between [ and ].) ===Usage >> regset "a-z" == make bitset! #{ 000000000000000000000000FEFFFF0700000000000000000000000000000000 } You can write a letter ("a"), a range ("a-z"), or you can exclude a set using "~" or "^". ---Escaped characters Escaped character must be escaped using "\" (back-slash). Following chars need to be escaped: . ^ $ * + ? { [ ] \ | ( ) Other escaped characters (typically whitespaces): \t - TAB \r - CR \n - LF \a - bell \e - escape \f - form feed \v - vertical tab ---Predefined sequences 'regset supports some predefined sqeunces: *\d Matches any decimal digit; this is equivalent to the class [0-9]. *\D Matches any non-digit character; this is equivalent to the class [^0-9]. *\s Matches any whitespace character; this is equivalent to the class [ \t\n\r\f\v]. *\S Matches any non-whitespace character; this is equivalent to the class [^ \t\n\r\f\v]. *\w Matches any alphanumeric character; this is equivalent to the class [a-zA-Z0-9_]. *\W Matches any non-alphanumeric character; this is equivalent to the class [^a-zA-Z0-9_]. ===Examples ---Usage with 'parse *parse a word (alphanum characters) >> parse "chleba" compose [some (regset "\w")] == true *parse a phone number >> parse "#340-5464" reduce ["#" 3 regset "\d" "-" 4 regset "\d"] == true