Outputs:use YAPE::Regex::Explain; $search = "\x8C\x95"; $encoding = q{ # Shift-JIS encoding [\x00-\x7F] # ASCII/JIS-Roman | [\x81-\x9F\xE0-\xFC][\x40-\x7E\x80-\xFC] # JIS X 0208:1997 | [\xA0-\xDF] # Half-width katakana }; $regex = qr/^ (?:$encoding)*? $search/osx; print YAPE::Regex::Explain->new($regex)->explain;
The regular expression: (?sx-im:^ (?: # Shift-JIS encoding [\x00-\x7F] # ASCII/JIS-Roman | [\x81-\x9F\xE0-\xFC][\x40-\x7E\x80-\xFC] # JIS X 0208:1997 | [\xA0-\xDF] # Half-width katakana )*? от) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?sx-im: group, but do not capture (with . matching \n) (disregarding whitespace and comments) (case-sensitive) (with ^ and $ matching normally): ---------------------------------------------------------------------- ^ the beginning of the string ---------------------------------------------------------------------- (?: group, but do not capture (0 or more times (matching the least amount possible)): ---------------------------------------------------------------------- [\x00-\x7F] any character of: '\x00' to '\x7F' ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- [\x81-\x9F\xE0- any character of: '\x81' to '\x9F', \xFC] '\xE0' to '\xFC' ---------------------------------------------------------------------- [\x40-\x7E\x80- any character of: '\x40' to '\x7E', \xFC] '\x80' to '\xFC' ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- [\xA0-\xDF] any character of: '\xA0' to '\xDF' ---------------------------------------------------------------------- )*? end of grouping ---------------------------------------------------------------------- от 'от' ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------
--
flounder
In reply to Re: regex question
by flounder99
in thread regex question
by Deda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |