Linux server1.dn-server.com 4.18.0-553.89.1.lve.el8.x86_64 #1 SMP Wed Dec 10 13:58:50 UTC 2025 x86_64
LiteSpeed
Server IP : 195.201.204.189 & Your IP : 216.73.216.37
Domains :
Cant Read [ /etc/named.conf ]
User : beriska1
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
opt /
alt /
ruby19 /
share /
ri /
1.9.1 /
system /
Regexp /
Delete
Unzip
Name
Size
Permission
Date
Action
%3d%3d%3d-i.ri
578
B
-rw-r--r--
2023-07-26 17:26
%3d%3d-i.ri
622
B
-rw-r--r--
2023-07-26 17:26
%3d%7e-i.ri
1.71
KB
-rw-r--r--
2023-07-26 17:26
%7e-i.ri
417
B
-rw-r--r--
2023-07-26 17:26
as_json-i.ri
288
B
-rw-r--r--
2023-07-26 17:26
casefold%3f-i.ri
444
B
-rw-r--r--
2023-07-26 17:26
cdesc-Regexp.ri
31.27
KB
-rw-r--r--
2023-07-26 17:26
compile-c.ri
216
B
-rw-r--r--
2023-07-26 17:26
encoding-i.ri
275
B
-rw-r--r--
2023-07-26 17:26
eql%3f-i.ri
626
B
-rw-r--r--
2023-07-26 17:26
escape-c.ri
610
B
-rw-r--r--
2023-07-26 17:26
fixed_encoding%3f-i.ri
1.37
KB
-rw-r--r--
2023-07-26 17:26
hash-i.ri
269
B
-rw-r--r--
2023-07-26 17:26
inspect-i.ri
497
B
-rw-r--r--
2023-07-26 17:26
json_create-c.ri
381
B
-rw-r--r--
2023-07-26 17:26
last_match-c.ri
1.22
KB
-rw-r--r--
2023-07-26 17:26
match-i.ri
1.05
KB
-rw-r--r--
2023-07-26 17:26
named_captures-i.ri
809
B
-rw-r--r--
2023-07-26 17:26
names-i.ri
509
B
-rw-r--r--
2023-07-26 17:26
new-c.ri
1.34
KB
-rw-r--r--
2023-07-26 17:26
options-i.ri
1.03
KB
-rw-r--r--
2023-07-26 17:26
quote-c.ri
608
B
-rw-r--r--
2023-07-26 17:26
source-i.ri
443
B
-rw-r--r--
2023-07-26 17:26
to_json-i.ri
313
B
-rw-r--r--
2023-07-26 17:26
to_s-i.ri
1.02
KB
-rw-r--r--
2023-07-26 17:26
try_convert-c.ri
704
B
-rw-r--r--
2023-07-26 17:26
union-c.ri
1.08
KB
-rw-r--r--
2023-07-26 17:26
Save
Rename
U:RDoc::NormalClass[iI"Regexp:ET@I"Object;Fo:RDoc::Markup::Document:@parts[o;;[�o:RDoc::Markup::Paragraph;[ I"NA <code>Regexp</code> holds a regular expression, used to match a pattern;TI"Jagainst strings. Regexps are created using the <code>/.../</code> and;TI"G<code>%r{...}</code> literals, and by the <code>Regexp::new</code>;TI"constructor.;To:RDoc::Markup::BlankLine o; ;[I"IRegular expressions (<i>regexp</i>s) are patterns which describe the;TI"Ocontents of a string. They're used for testing whether a string contains a;TI"Kgiven pattern, or extracting the portions that match. They are created;TI"0with the <tt>/</tt><i>pat</i><tt>/</tt> and;TI"I<tt>%r{</tt><i>pat</i><tt>}</tt> literals or the <tt>Regexp.new</tt>;TI"constructor.;T@o; ;[I"IA regexp is usually delimited with forward slashes (<tt>/</tt>). For;TI" example:;T@o:RDoc::Markup::Verbatim;[I"!/hay/ =~ 'haystack' #=> 0 ;FI"0/y/.match('haystack') #=> #<MatchData "y"> ;Fo; ;[I"KIf a string contains the pattern it is said to <i>match</i>. A literal;TI"string matches itself.;T@o;;[ I"K# 'haystack' does not contain the pattern 'needle', so doesn't match. ;FI"(/needle/.match('haystack') #=> nil ;FI"@# 'haystack' does contain the pattern 'hay', so it matches ;FI"7/hay/.match('haystack') #=> #<MatchData "hay"> ;Fo; ;[I"MSpecifically, <tt>/st/</tt> requires that the string contains the letter;TI"D_s_ followed by the letter _t_, so it matches _haystack_, also.;T@S:RDoc::Markup::Heading: leveli: textI"Metacharacters and Escapes;T@o; ;[ I"DThe following are <i>metacharacters</i> <tt>(</tt>, <tt>)</tt>,;TI"L<tt>[</tt>, <tt>]</tt>, <tt>{</tt>, <tt>}</tt>, <tt>.</tt>, <tt>?</tt>,;TI"M<tt>+</tt>, <tt>*</tt>. They have a specific meaning when appearing in a;TI"Npattern. To match them literally they must be backslash-escaped. To match;TI"Ba backslash literally backslash-escape that: <tt>\\\\\\</tt>.;T@o;;[I"K/1 \+ 2 = 3\?/.match('Does 1 + 2 = 3?') #=> #<MatchData "1 + 2 = 3?"> ;Fo; ;[I"GPatterns behave like double-quoted strings so can contain the same;TI"backslash escapes.;T@o;;[I"5/\s\u{6771 4eac 90fd}/.match("Go to 東京都") ;TI"' #=> #<MatchData " 東京都"> ;To; ;[I"FArbitrary Ruby expressions can be embedded into patterns with the;TI"<tt>#{...}</tt> construct.;T@o;;[I"place = "東京都" ;TI")/#{place}/.match("Go to 東京都") ;TI"& #=> #<MatchData "東京都"> ;TS;; i;I"Character Classes;T@o; ;[ I"LA <i>character class</i> is delimited with square brackets (<tt>[</tt>,;TI"J<tt>]</tt>) and lists characters that may appear at that point in the;TI"Omatch. <tt>/[ab]/</tt> means _a_ or _b_, as opposed to <tt>/ab/</tt> which;TI"means _a_ followed by _b_.;T@o;;[I"8/W[aeiou]rd/.match("Word") #=> #<MatchData "Word"> ;Fo; ;[I"HWithin a character class the hyphen (<tt>-</tt>) is a metacharacter;TI"Mdenoting an inclusive range of characters. <tt>[abcd]</tt> is equivalent;TI"Dto <tt>[a-d]</tt>. A range can be followed by another range, so;TI"O<tt>[abcdwxyz]</tt> is equivalent to <tt>[a-dw-z]</tt>. The order in which;TI"Granges or individual characters appear inside a character class is;TI"irrelevant.;T@o;;[I"1/[0-9a-f]/.match('9f') #=> #<MatchData "9"> ;FI"1/[9f]/.match('9f') #=> #<MatchData "9"> ;Fo; ;[I"LIf the first character of a character class is a caret (<tt>^</tt>) the;TI"Fclass is inverted: it matches any character _except_ those named.;T@o;;[I"1/[^a-eg-z]/.match('f') #=> #<MatchData "f"> ;Fo; ;[ I"JA character class may contain another character class. By itself this;TI"Gisn't useful because <tt>[a-z[0-9]]</tt> describes the same set as;TI"O<tt>[a-z0-9]</tt>. However, character classes also support the <tt>&&</tt>;TI"Noperator which performs set intersection on its arguments. The two can be;TI"combined as follows:;T@o;;[I"2/[a-w&&[^c-g]z]/ # ([a-w] AND ([^c-g] OR z)) ;FI"# This is equivalent to: ;FI"/[abh-w]/ ;Fo; ;[I"EThe following metacharacters also behave like character classes:;T@o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;[o; ;[I"3<tt>/./</tt> - Any character except a newline.;To;;0;[o; ;[I"L<tt>/./m</tt> - Any character (the +m+ modifier enables multiline mode);To;;0;[o; ;[I"=<tt>/\w/</tt> - A word character (<tt>[a-zA-Z0-9_]</tt>);To;;0;[o; ;[I"B<tt>/\W/</tt> - A non-word character (<tt>[^a-zA-Z0-9_]</tt>);To;;0;[o; ;[I"7<tt>/\d/</tt> - A digit character (<tt>[0-9]</tt>);To;;0;[o; ;[I"<<tt>/\D/</tt> - A non-digit character (<tt>[^0-9]</tt>);To;;0;[o; ;[I"@<tt>/\h/</tt> - A hexdigit character (<tt>[0-9a-fA-F]</tt>);To;;0;[o; ;[I"E<tt>/\H/</tt> - A non-hexdigit character (<tt>[^0-9a-fA-F]</tt>);To;;0;[o; ;[I"C<tt>/\s/</tt> - A whitespace character: <tt>/[ \t\r\n\f]/</tt>;To;;0;[o; ;[I"H<tt>/\S/</tt> - A non-whitespace character: <tt>/[^ \t\r\n\f]/</tt>;T@o; ;[ I"LPOSIX <i>bracket expressions</i> are also similar to character classes.;TI"MThey provide a portable alternative to the above, with the added benefit;TI"Jthat they encompass non-ASCII characters. For instance, <tt>/\d/</tt>;TI"Pmatches only the ASCII decimal digits (0-9); whereas <tt>/[[:digit:]]/</tt>;TI"8matches any character in the Unicode _Nd_ category.;T@o;;;;[o;;0;[o; ;[I"><tt>/[[:alnum:]]/</tt> - Alphabetic and numeric character;To;;0;[o; ;[I"2<tt>/[[:alpha:]]/</tt> - Alphabetic character;To;;0;[o; ;[I"*<tt>/[[:blank:]]/</tt> - Space or tab;To;;0;[o; ;[I"/<tt>/[[:cntrl:]]/</tt> - Control character;To;;0;[o; ;[I"#<tt>/[[:digit:]]/</tt> - Digit;To;;0;[o; ;[I"K<tt>/[[:graph:]]/</tt> - Non-blank character (excludes spaces, control;TI"characters, and similar);To;;0;[o; ;[I"><tt>/[[:lower:]]/</tt> - Lowercase alphabetical character;To;;0;[o; ;[I"N<tt>/[[:print:]]/</tt> - Like [:graph:], but includes the space character;To;;0;[o; ;[I"3<tt>/[[:punct:]]/</tt> - Punctuation character;To;;0;[o; ;[I"P<tt>/[[:space:]]/</tt> - Whitespace character (<tt>[:blank:]</tt>, newline,;To;;[I"carriage return, etc.) ;Fo;;0;[o; ;[I"4<tt>/[[:upper:]]/</tt> - Uppercase alphabetical;To;;0;[o; ;[I"K<tt>/[[:xdigit:]]/</tt> - Digit allowed in a hexadecimal number (i.e.,;TI"0-9a-fA-F);T@o; ;[I"BRuby also supports the following non-POSIX character classes:;T@o;;;;[o;;0;[o; ;[I"H<tt>/[[:word:]]/</tt> - A character in one of the following Unicode;TI"3general categories _Letter_, _Mark_, _Number_,;TI"!<i>Connector_Punctuation</i>;To;;0;[o; ;[I"D<tt>/[[:ascii:]]/</tt> - A character in the ASCII character set;T@o;;[ I"3# U+06F2 is "EXTENDED ARABIC-INDIC DIGIT TWO" ;FI"B/[[:digit:]]/.match("\u06F2") #=> #<MatchData "\u{06F2}"> ;FI"C/[[:upper:]][[:lower:]]/.match("Hello") #=> #<MatchData "He"> ;FI"C/[[:xdigit:]][[:xdigit:]]/.match("A6") #=> #<MatchData "A6"> ;FS;; i;I"Repetition;T@o; ;[I"JThe constructs described so far match a single character. They can be;TI"Ofollowed by a repetition metacharacter to specify how many times they need;TI"Ato occur. Such metacharacters are called <i>quantifiers</i>.;T@o;;;;[o;;0;[o; ;[I"$<tt>*</tt> - Zero or more times;To;;0;[o; ;[I"#<tt>+</tt> - One or more times;To;;0;[o; ;[I".<tt>?</tt> - Zero or one times (optional);To;;0;[o; ;[I":<tt>{</tt><i>n</i><tt>}</tt> - Exactly <i>n</i> times;To;;0;[o; ;[I";<tt>{</tt><i>n</i><tt>,}</tt> - <i>n</i> or more times;To;;0;[o; ;[I";<tt>{,</tt><i>m</i><tt>}</tt> - <i>m</i> or less times;To;;0;[o; ;[I"K<tt>{</tt><i>n</i><tt>,</tt><i>m</i><tt>}</tt> - At least <i>n</i> and;TI"at most <i>m</i> times;T@o;;[I"F# At least one uppercase character ('H'), at least one lowercase ;FI"9# character ('e'), two 'l' characters, then one 'o' ;FI"M"Hello".match(/[[:upper:]]+[[:lower:]]+l{2}o/) #=> #<MatchData "Hello"> ;Fo; ;[ I"LRepetition is <i>greedy</i> by default: as many occurrences as possible;TI"Fare matched while still allowing the overall match to succeed. By;TI"Gcontrast, <i>lazy</i> matching makes the minimal amount of matches;TI"Nnecessary for overall success. A greedy metacharacter can be made lazy by;TI""following it with <tt>?</tt>.;T@o;;[ I"E# Both patterns below match the string. The first uses a greedy ;FI"C# quantifier so '.+' matches '<a><b>'; the second uses a lazy ;FI"*# quantifier so '.+?' matches '<a>'. ;FI"7/<.+>/.match("<a><b>") #=> #<MatchData "<a><b>"> ;FI"4/<.+?>/.match("<a><b>") #=> #<MatchData "<a>"> ;Fo; ;[ I"MA quantifier followed by <tt>+</tt> matches <i>possessively</i>: once it;TI"Lhas matched it does not backtrack. They behave like greedy quantifiers,;TI"Ibut having matched they refuse to "give up" their match even if this;TI"#jeopardises the overall match.;T@S;; i;I"Capturing;T@o; ;[ I"KParentheses can be used for <i>capturing</i>. The text enclosed by the;TI"O<i>n</i><sup>th</sup> group of parentheses can be subsequently referred to;TI"Awith <i>n</i>. Within a pattern use the <i>backreference</i>;TI"3<tt>\</tt><i>n</i>; outside of the pattern use;TI"+<tt>MatchData[</tt><i>n</i><tt>]</tt>.;T@o;;[I"L# 'at' is captured by the first group of parentheses, then referred to ;FI"# later with \1 ;FI"</[csh](..) [csh]\1 in/.match("The cat sat in the hat") ;FI". #=> #<MatchData "cat sat in" 1:"at"> ;FI"H# Regexp#match returns a MatchData object which makes the captured ;FI"+# text available with its #[] method. ;FI"H/[csh](..) [csh]\1 in/.match("The cat sat in the hat")[1] #=> 'at' ;Fo; ;[I"DCapture groups can be referred to by name when defined with the;TI"M<tt>(?<</tt><i>name</i><tt>>)</tt> or <tt>(?'</tt><i>name</i><tt>')</tt>;TI"constructs.;T@o;;[I"7/\$(?<dollars>\d+)\.(?<cents>\d+)/.match("$3.67") ;FI"8 => #<MatchData "$3.67" dollars:"3" cents:"67"> ;FI"I/\$(?<dollars>\d+)\.(?<cents>\d+)/.match("$3.67")[:dollars] #=> "3" ;Fo; ;[I"ONamed groups can be backreferenced with <tt>\k<</tt><i>name</i><tt>></tt>,;TI"$where _name_ is the group name.;T@o;;[I">/(?<vowel>[aeiou]).\k<vowel>.\k<vowel>/.match('ototomy') ;FI", #=> #<MatchData "ototo" vowel:"o"> ;Fo; ;[I"A*Note*: A regexp can't use named backreferences and numbered;TI"#backreferences simultaneously.;T@o; ;[I"NWhen named capture groups are used with a literal regexp on the left-hand;TI"Mside of an expression and the <tt>=~</tt> operator, the captured text is;TI"?also assigned to local variables with corresponding names.;T@o;;[I"9/\$(?<dollars>\d+)\.(?<cents>\d+)/ =~ "$3.67" #=> 0 ;FI"dollars #=> "3" ;FS;; i;I" Grouping;T@o; ;[I"NParentheses also <i>group</i> the terms they enclose, allowing them to be;TI"+quantified as one <i>atomic</i> whole.;T@o;;[I"H# The pattern below matches a vowel followed by 2 word characters: ;FI" # 'aen' ;FI"K/[aeiou]\w{2}/.match("Caenorhabditis elegans") #=> #<MatchData "aen"> ;FI"H# Whereas the following pattern matches a vowel followed by a word ;FI"C# character, twice, i.e. <tt>[aeiou]\w[aeiou]\w</tt>: 'enor'. ;FI"6/([aeiou]\w){2}/.match("Caenorhabditis elegans") ;FI"( #=> #<MatchData "enor" 1:"or"> ;Fo; ;[ I"FThe <tt>(?:</tt>...<tt>)</tt> construct provides grouping without;TI"Ocapturing. That is, it combines the terms it contains into an atomic whole;TI"Nwithout creating a backreference. This benefits performance at the slight;TI"expense of readabilty.;T@o;;[I"F# The group of parentheses captures 'n' and the second 'ti'. The ;FI"C# second group is referred to later with the backreference \2 ;FI"2/I(n)ves(ti)ga\2ons/.match("Investigations") ;FI"8 #=> #<MatchData "Investigations" 1:"n" 2:"ti"> ;FI"K# The first group of parentheses is now made non-capturing with '?:', ;FI"L# so it still matches 'n', but doesn't create the backreference. Thus, ;FI"0# the backreference \1 now refers to 'ti'. ;FI"4/I(?:n)ves(ti)ga\1ons/.match("Investigations") ;FI"2 #=> #<MatchData "Investigations" 1:"ti"> ;FS;; i;I"Atomic Grouping;T@o; ;[ I",Grouping can be made <i>atomic</i> with;TI"O<tt>(?></tt><i>pat</i><tt>)</tt>. This causes the subexpression <i>pat</i>;TI"Mto be matched independently of the rest of the expression such that what;TI"Oit matches becomes fixed for the remainder of the match, unless the entire;TI"Hsubexpression must be abandoned and subsequently revisited. In this;TI"Kway <i>pat</i> is treated as a non-divisible whole. Atomic grouping is;TI"Etypically used to optimise patterns so as to prevent the regular;TI"3expression engine from backtracking needlesly.;T@o;;[I"J# The <tt>"</tt> in the pattern below matches the first character of ;FI"K# the string, then <tt>.*</tt> matches <i>Quote"</i>. This causes the ;FI"D# overall match to fail, so the text matched by <tt>.*</tt> is ;FI"L# backtracked by one position, which leaves the final character of the ;FI",# string available to match <tt>"</tt> ;FI"D /".*"/.match('"Quote"') #=> #<MatchData "\"Quote\""> ;FI"E# If <tt>.*</tt> is grouped atomically, it refuses to backtrack ;FI"J# <i>Quote"</i>, even though this means that the overall match fails ;FI")/"(?>.*)"/.match('"Quote"') #=> nil ;FS;; i;I"Subexpression Calls;T@o; ;[ I"FThe <tt>\g<</tt><i>name</i><tt>></tt> syntax matches the previous;TI"Lsubexpression named _name_, which can be a group name or number, again.;TI"MThis differs from backreferences in that it re-executes the group rather;TI"2than simply trying to re-match the same text.;T@o;;[I"I# Matches a <i>(</i> character and assigns it to the <tt>paren</tt> ;FI"I# group, tries to call that the <tt>paren</tt> sub-expression again ;FI"3# but fails, then matches a literal <i>)</i>. ;FI"-/\A(?<paren>\(\g<paren>*\))*\z/ =~ '()' ;FI" ;FI"5/\A(?<paren>\(\g<paren>*\))*\z/ =~ '(())' #=> 0 ;FI" # ^1 ;FI"# ^2 ;FI"# ^3 ;FI"# ^4 ;FI"# ^5 ;FI"# ^6 ;FI"# ^7 ;FI" # ^8 ;FI" # ^9 ;FI"%# ^10 ;Fo;;:NUMBER;[o;;0;[o; ;[I"BMatches at the beginning of the string, i.e. before the first;TI"character.;To;;0;[o; ;[I"7Enters a named capture group called <tt>paren</tt>;To;;0;[o; ;[I"BMatches a literal <i>(</i>, the first character in the string;To;;0;[o; ;[I"DCalls the <tt>paren</tt> group again, i.e. recurses back to the;TI"second step;To;;0;[o; ;[I"'Re-enters the <tt>paren</tt> group;To;;0;[o; ;[I"<Matches a literal <i>(</i>, the second character in the;TI"string;To;;0;[o; ;[I">Try to call <tt>paren</tt> a third time, but fail because;TI"7doing so would prevent an overall successful match;To;;0;[o; ;[I"AMatch a literal <i>)</i>, the third character in the string.;TI"/Marks the end of the second recursive call;To;;0;[o; ;[I"AMatch a literal <i>)</i>, the fourth character in the string;To;;0;[o; ;[I" Match the end of the string;T@S;; i;I"Alternation;T@o; ;[I"NThe vertical bar metacharacter (<tt>|</tt>) combines two expressions into;TI"Oa single one that matches either of the expressions. Each expression is an;TI"<i>alternative</i>.;T@o;;[I"G/\w(and|or)\w/.match("Feliformia") #=> #<MatchData "form" 1:"or"> ;FI"I/\w(and|or)\w/.match("furandi") #=> #<MatchData "randi" 1:"and"> ;FI"2/\w(and|or)\w/.match("dissemblance") #=> nil ;FS;; i;I"Character Properties;T@o; ;[I"LThe <tt>\p{}</tt> construct matches characters with the named property,;TI"%much like POSIX bracket classes.;T@o;;;;[o;;0;[o; ;[I"<<tt>/\p{Alnum}/</tt> - Alphabetic and numeric character;To;;0;[o; ;[I"0<tt>/\p{Alpha}/</tt> - Alphabetic character;To;;0;[o; ;[I"(<tt>/\p{Blank}/</tt> - Space or tab;To;;0;[o; ;[I"-<tt>/\p{Cntrl}/</tt> - Control character;To;;0;[o; ;[I"!<tt>/\p{Digit}/</tt> - Digit;To;;0;[o; ;[I"I<tt>/\p{Graph}/</tt> - Non-blank character (excludes spaces, control;TI"characters, and similar);To;;0;[o; ;[I"<<tt>/\p{Lower}/</tt> - Lowercase alphabetical character;To;;0;[o; ;[I"U<tt>/\p{Print}/</tt> - Like <tt>\p{Graph}</tt>, but includes the space character;To;;0;[o; ;[I"1<tt>/\p{Punct}/</tt> - Punctuation character;To;;0;[o; ;[I"N<tt>/\p{Space}/</tt> - Whitespace character (<tt>[:blank:]</tt>, newline,;TI"carriage return, etc.);To;;0;[o; ;[I"2<tt>/\p{Upper}/</tt> - Uppercase alphabetical;To;;0;[o; ;[I"T<tt>/\p{XDigit}/</tt> - Digit allowed in a hexadecimal number (i.e., 0-9a-fA-F);To;;0;[o; ;[I"K<tt>/\p{Word}/</tt> - A member of one of the following Unicode general;TI"8category <i>Letter</i>, <i>Mark</i>, <i>Number</i>,;TI""<i>Connector\_Punctuation</i>;To;;0;[o; ;[I"B<tt>/\p{ASCII}/</tt> - A character in the ASCII character set;To;;0;[o; ;[I"E<tt>/\p{Any}/</tt> - Any Unicode character (including unassigned;TI"characters);To;;0;[o; ;[I"4<tt>/\p{Assigned}/</tt> - An assigned character;T@o; ;[I"LA Unicode character's <i>General Category</i> value can also be matched;TI"Kwith <tt>\p{</tt><i>Ab</i><tt>}</tt> where <i>Ab</i> is the category's;TI"%abbreviation as described below:;T@o;;;;[,o;;0;[o; ;[I" <tt>/\p{L}/</tt> - 'Letter';To;;0;[o; ;[I",<tt>/\p{Ll}/</tt> - 'Letter: Lowercase';To;;0;[o; ;[I"'<tt>/\p{Lm}/</tt> - 'Letter: Mark';To;;0;[o; ;[I"(<tt>/\p{Lo}/</tt> - 'Letter: Other';To;;0;[o; ;[I",<tt>/\p{Lt}/</tt> - 'Letter: Titlecase';To;;0;[o; ;[I"+<tt>/\p{Lu}/</tt> - 'Letter: Uppercase;To;;0;[o; ;[I"(<tt>/\p{Lo}/</tt> - 'Letter: Other';To;;0;[o; ;[I"<tt>/\p{M}/</tt> - 'Mark';To;;0;[o; ;[I"+<tt>/\p{Mn}/</tt> - 'Mark: Nonspacing';To;;0;[o; ;[I"2<tt>/\p{Mc}/</tt> - 'Mark: Spacing Combining';To;;0;[o; ;[I"*<tt>/\p{Me}/</tt> - 'Mark: Enclosing';To;;0;[o; ;[I" <tt>/\p{N}/</tt> - 'Number';To;;0;[o; ;[I"0<tt>/\p{Nd}/</tt> - 'Number: Decimal Digit';To;;0;[o; ;[I")<tt>/\p{Nl}/</tt> - 'Number: Letter';To;;0;[o; ;[I"(<tt>/\p{No}/</tt> - 'Number: Other';To;;0;[o; ;[I"%<tt>/\p{P}/</tt> - 'Punctuation';To;;0;[o; ;[I"1<tt>/\p{Pc}/</tt> - 'Punctuation: Connector';To;;0;[o; ;[I",<tt>/\p{Pd}/</tt> - 'Punctuation: Dash';To;;0;[o; ;[I",<tt>/\p{Ps}/</tt> - 'Punctuation: Open';To;;0;[o; ;[I"-<tt>/\p{Pe}/</tt> - 'Punctuation: Close';To;;0;[o; ;[I"5<tt>/\p{Pi}/</tt> - 'Punctuation: Initial Quote';To;;0;[o; ;[I"3<tt>/\p{Pf}/</tt> - 'Punctuation: Final Quote';To;;0;[o; ;[I"-<tt>/\p{Po}/</tt> - 'Punctuation: Other';To;;0;[o; ;[I" <tt>/\p{S}/</tt> - 'Symbol';To;;0;[o; ;[I"'<tt>/\p{Sm}/</tt> - 'Symbol: Math';To;;0;[o; ;[I"+<tt>/\p{Sc}/</tt> - 'Symbol: Currency';To;;0;[o; ;[I"+<tt>/\p{Sc}/</tt> - 'Symbol: Currency';To;;0;[o; ;[I"+<tt>/\p{Sk}/</tt> - 'Symbol: Modifier';To;;0;[o; ;[I"(<tt>/\p{So}/</tt> - 'Symbol: Other';To;;0;[o; ;[I"#<tt>/\p{Z}/</tt> - 'Separator';To;;0;[o; ;[I"+<tt>/\p{Zs}/</tt> - 'Separator: Space';To;;0;[o; ;[I"*<tt>/\p{Zl}/</tt> - 'Separator: Line';To;;0;[o; ;[I"/<tt>/\p{Zp}/</tt> - 'Separator: Paragraph';To;;0;[o; ;[I"<tt>/\p{C}/</tt> - 'Other';To;;0;[o; ;[I")<tt>/\p{Cc}/</tt> - 'Other: Control';To;;0;[o; ;[I"(<tt>/\p{Cf}/</tt> - 'Other: Format';To;;0;[o; ;[I".<tt>/\p{Cn}/</tt> - 'Other: Not Assigned';To;;0;[o; ;[I"-<tt>/\p{Co}/</tt> - 'Other: Private Use';To;;0;[o; ;[I"+<tt>/\p{Cs}/</tt> - 'Other: Surrogate';T@o; ;[I"KLastly, <tt>\p{}</tt> matches a character's Unicode <i>script</i>. The;TI"Efollowing scripts are supported: <i>Arabic</i>, <i>Armenian</i>,;TI"F<i>Balinese</i>, <i>Bengali</i>, <i>Bopomofo</i>, <i>Braille</i>,;TI"N<i>Buginese</i>, <i>Buhid</i>, <i>Canadian_Aboriginal</i>, <i>Carian</i>,;TI"@<i>Cham</i>, <i>Cherokee</i>, <i>Common</i>, <i>Coptic</i>,;TI"G<i>Cuneiform</i>, <i>Cypriot</i>, <i>Cyrillic</i>, <i>Deseret</i>,;TI"L<i>Devanagari</i>, <i>Ethiopic</i>, <i>Georgian</i>, <i>Glagolitic</i>,;TI"O<i>Gothic</i>, <i>Greek</i>, <i>Gujarati</i>, <i>Gurmukhi</i>, <i>Han</i>,;TI"C<i>Hangul</i>, <i>Hanunoo</i>, <i>Hebrew</i>, <i>Hiragana</i>,;TI"H<i>Inherited</i>, <i>Kannada</i>, <i>Katakana</i>, <i>Kayah_Li</i>,;TI"N<i>Kharoshthi</i>, <i>Khmer</i>, <i>Lao</i>, <i>Latin</i>, <i>Lepcha</i>,;TI"A<i>Limbu</i>, <i>Linear_B</i>, <i>Lycian</i>, <i>Lydian</i>,;TI"L<i>Malayalam</i>, <i>Mongolian</i>, <i>Myanmar</i>, <i>New_Tai_Lue</i>,;TI"B<i>Nko</i>, <i>Ogham</i>, <i>Ol_Chiki</i>, <i>Old_Italic</i>,;TI"G<i>Old_Persian</i>, <i>Oriya</i>, <i>Osmanya</i>, <i>Phags_Pa</i>,;TI"G<i>Phoenician</i>, <i>Rejang</i>, <i>Runic</i>, <i>Saurashtra</i>,;TI"K<i>Shavian</i>, <i>Sinhala</i>, <i>Sundanese</i>, <i>Syloti_Nagri</i>,;TI"C<i>Syriac</i>, <i>Tagalog</i>, <i>Tagbanwa</i>, <i>Tai_Le</i>,;TI"M<i>Tamil</i>, <i>Telugu</i>, <i>Thaana</i>, <i>Thai</i>, <i>Tibetan</i>,;TI"A<i>Tifinagh</i>, <i>Ugaritic</i>, <i>Vai</i>, and <i>Yi</i>.;T@o;;[I"F# Unicode codepoint U+06E9 is named "ARABIC PLACE OF SAJDAH" and ;FI"%# belongs to the Arabic script. ;FI"</\p{Arabic}/.match("\u06E9") #=> #<MatchData "\u06E9"> ;Fo; ;[I"LAll character properties can be inverted by prefixing their name with a;TI"caret (<tt>^</tt>).;T@o;;[I"L# Letter 'A' is not in the Unicode Ll (Letter; Lowercase) category, so ;FI"# this match succeeds ;FI"//\p{^Ll}/.match("A") #=> #<MatchData "A"> ;FS;; i;I"Anchors;T@o; ;[I"JAnchors are metacharacter that match the zero-width positions between;TI"Ccharacters, <i>anchoring</i> the match to a specific position.;T@o;;;;[o;;0;[o; ;[I"+<tt>^</tt> - Matches beginning of line;To;;0;[o; ;[I"%<tt>$</tt> - Matches end of line;To;;0;[o; ;[I"/<tt>\A</tt> - Matches beginning of string.;To;;0;[o; ;[I"H<tt>\Z</tt> - Matches end of string. If string ends with a newline,;TI"#it matches just before newline;To;;0;[o; ;[I"(<tt>\z</tt> - Matches end of string;To;;0;[o; ;[I":<tt>\G</tt> - Matches point where last match finished;To;;0;[o; ;[I"A<tt>\b</tt> - Matches word boundaries when outside brackets;;TI"*backspace (0x08) when inside brackets;To;;0;[o; ;[I".<tt>\B</tt> - Matches non-word boundaries;To;;0;[o; ;[I"L<tt>(?=</tt><i>pat</i><tt>)</tt> - <i>Positive lookahead</i> assertion:;TI"Hensures that the following characters match <i>pat</i>, but doesn't;TI"1include those characters in the matched text;To;;0;[o; ;[I"L<tt>(?!</tt><i>pat</i><tt>)</tt> - <i>Negative lookahead</i> assertion:;TI"Gensures that the following characters do not match <i>pat</i>, but;TI"9doesn't include those characters in the matched text;To;;0;[o; ;[I"C<tt>(?<=</tt><i>pat</i><tt>)</tt> - <i>Positive lookbehind</i>;TI"Kassertion: ensures that the preceding characters match <i>pat</i>, but;TI"9doesn't include those characters in the matched text;To;;0;[o; ;[I"C<tt>(?<!</tt><i>pat</i><tt>)</tt> - <i>Negative lookbehind</i>;TI"Bassertion: ensures that the preceding characters do not match;TI"I<i>pat</i>, but doesn't include those characters in the matched text;T@o;;[I"K# If a pattern isn't anchored it can begin at any point in the string ;FI"8/real/.match("surrealist") #=> #<MatchData "real"> ;FI"G# Anchoring the pattern to the beginning of the string forces the ;FI"J# match to start there. 'real' doesn't occur at the beginning of the ;FI"&# string, so now the match fails ;FI"*/\Areal/.match("surrealist") #=> nil ;FI"K# The match below fails because although 'Demand' contains 'and', the ;FI"0pattern does not occur at a word boundary. ;FI"/\band/.match("Demand") ;FI"E# Whereas in the following example 'and' has been anchored to a ;FI"K# non-word boundary so instead of matching the first 'and' it matches ;FI"2# from the fourth letter of 'demand' instead ;FI"M/\Band.+/.match("Supply and demand curve") #=> #<MatchData "and curve"> ;FI"L# The pattern below uses positive lookahead and positive lookbehind to ;FI"N# match text appearing in <b></b> tags without including the tags in the ;FI" # match ;FI"E/(?<=<b>)\w+(?=<\/b>)/.match("Fortune favours the <b>bold</b>") ;FI"! #=> #<MatchData "bold"> ;FS;; i;I"Options;T@o; ;[I"PThe end delimiter for a regexp can be followed by one or more single-letter;TI"5options which control how the pattern can match.;T@o;;;;[ o;;0;[o; ;[I""<tt>/pat/i</tt> - Ignore case;To;;0;[o; ;[I"K<tt>/pat/m</tt> - Treat a newline as a character matched by <tt>.</tt>;To;;0;[o; ;[I"D<tt>/pat/x</tt> - Ignore whitespace and comments in the pattern;To;;0;[o; ;[I"C<tt>/pat/o</tt> - Perform <tt>#{}</tt> interpolation only once;T@o; ;[ I"F<tt>i</tt>, <tt>m</tt>, and <tt>x</tt> can also be applied on the;TI"!subexpression level with the;TI"H<tt>(?</tt><i>on</i><tt>-</tt><i>off</i><tt>)</tt> construct, which;TI"Genables options <i>on</i>, and disables options <i>off</i> for the;TI",expression enclosed by the parentheses.;T@o;;[I"4/a(?i:b)c/.match('aBc') #=> #<MatchData "aBc"> ;FI"4/a(?i:b)c/.match('abc') #=> #<MatchData "abc"> ;FS;; i;I"#Free-Spacing Mode and Comments;T@o; ;[ I"JAs mentioned above, the <tt>x</tt> option enables <i>free-spacing</i>;TI"Emode. Literal white space inside the pattern is ignored, and the;TI"Loctothorpe (<tt>#</tt>) character introduces a comment until the end of;TI"Mthe line. This allows the components of the pattern to be organised in a;TI"'potentially more readable fashion.;T@o;;[ I"J# A contrived pattern to match a number with optional decimal places ;FI"float_pat = /\A ;FI"B [[:digit:]]+ # 1 or more digits before the decimal point ;FI"& (\. # Decimal point ;FI"E [[:digit:]]+ # 1 or more digits after the decimal point ;FI"B )? # The decimal point and following digits are optional ;FI" \Z/x ;FI"=float_pat.match('3.14') #=> #<MatchData "3.14" 1:".14"> ;Fo; ;[I"O*Note*: To match whitespace in an <tt>x</tt> pattern use an escape such as;TI"'<tt>\s</tt> or <tt>\p{Space}</tt>.;T@o; ;[I"BComments can be included in a non-<tt>x</tt> pattern with the;TI"L<tt>(?#</tt><i>comment</i><tt>)</tt> construct, where <i>comment</i> is;TI"1arbitrary text ignored by the regexp engine.;T@S;; i;I" Encoding;T@o; ;[I"LRegular expressions are assumed to use the source encoding. This can be;TI"4overridden with one of the following modifiers.;T@o;;;;[ o;;0;[o; ;[I",<tt>/</tt><i>pat</i><tt>/u</tt> - UTF-8;To;;0;[o; ;[I"-<tt>/</tt><i>pat</i><tt>/e</tt> - EUC-JP;To;;0;[o; ;[I"2<tt>/</tt><i>pat</i><tt>/s</tt> - Windows-31J;To;;0;[o; ;[I"1<tt>/</tt><i>pat</i><tt>/n</tt> - ASCII-8BIT;T@o; ;[I"GA regexp can be matched against a string when they either share an;TI"Oencoding, or the regexp's encoding is _US-ASCII_ and the string's encoding;TI"is ASCII-compatible.;T@o; ;[I">If a match between incompatible encodings is attempted an;TI"?<tt>Encoding::CompatibilityError</tt> exception is raised.;T@o; ;[ I"OThe <tt>Regexp#fixed_encoding?</tt> predicate indicates whether the regexp;TI"Hhas a <i>fixed</i> encoding, that is one incompatible with ASCII. A;TI";regexp's encoding can be explicitly fixed by supplying;TI"=<tt>Regexp::FIXEDENCODING</tt> as the second argument of;TI"<tt>Regexp.new</tt>:;T@o;;[ I"Lr = Regexp.new("a".force_encoding("iso-8859-1"),Regexp::FIXEDENCODING) ;FI"r =~"a\u3042" ;FI"M #=> Encoding::CompatibilityError: incompatible encoding regexp match ;FI"3 (ISO-8859-1 regexp with UTF-8 string) ;FS;; i;I"Performance;T@o; ;[I"NCertain pathological combinations of constructs can lead to abysmally bad;TI"performance.;T@o; ;[I"FConsider a string of 25 <i>a</i>s, a <i>d</i>, 4 <i>a</i>s, and a;TI"<i>c</i>.;T@o;;[I"&s = 'a' * 25 + 'd' 'a' * 4 + 'c' ;FI"2 #=> "aaaaaaaaaaaaaaaaaaaaaaaaadadadadac" ;Fo; ;[I"@The following patterns match instantly as you would expect:;T@o;;[I"/(b|a)/ =~ s #=> 0 ;FI"/(b|a+)/ =~ s #=> 0 ;FI"/(b|a+)*\/ =~ s #=> 0 ;Fo; ;[I"=However, the following pattern takes appreciably longer:;T@o;;[I"/(b|a+)*c/ =~ s #=> 32 ;Fo; ;[ I"HThis happens because an atom in the regexp is quantified by both an;TI"Eimmediate <tt>+</tt> and an enclosing <tt>*</tt> with nothing to;TI"Gdifferentiate which is in control of any particular character. The;TI"Lnondeterminism that results produces super-linear performance. (Consult;TI"?<i>Mastering Regular Expressions</i> (3rd ed.), pp 222, by;TI"K<i>Jeffery Friedl</i>, for an in-depth analysis). This particular case;TI"Kcan be fixed by use of atomic grouping, which prevents the unnecessary;TI"backtracking:;T@o;;[ I"A(start = Time.now) && /(b|a+)*c/ =~ s && (Time.now - start) ;FI" #=> 24.702736882 ;FI"C(start = Time.now) && /(?>b|a+)*c/ =~ s && (Time.now - start) ;FI" #=> 0.000166571 ;Fo; ;[I"EA similar case is typified by the following example, which takes;TI"0approximately 60 seconds to execute for me:;T@o;;[I"G# Match a string of 29 <i>a</i>s against a pattern of 29 optional ;FI"5# <i>a</i>s followed by 29 mandatory <i>a</i>s. ;FI"2Regexp.new('a?' * 29 + 'a' * 29) =~ 'a' * 29 ;Fo; ;[ I"IThe 29 optional <i>a</i>s match the string, but this prevents the 29;TI"Lmandatory <i>a</i>s that follow from matching. Ruby must then backtrack;TI"Jrepeatedly so as to satisfy as many of the optional matches as it can;TI"Nwhile still matching the mandatory 29. It is plain to us that none of the;TI"Koptional matches can succeed, but this fact unfortunately eludes Ruby.;T@o; ;[I"IOne approach for improving performance is to anchor the match to the;TI"Gbeginning of the string, thus significantly reducing the amount of;TI"backtracking needed.;T@o;;[I";Regexp.new('\A' 'a?' * 29 + 'a' * 29).match('a' * 29) ;FI"9 #=> #<MatchData "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa">;F: @fileI" re.c;To;;[o; ;[I")Regexp serialization/deserialization;T;I""ext/json/lib/json/add/core.rb;T;0[ [ [I"IGNORECASE;To;;[o; ;[I")see Regexp.options and Regexp.new ;T;0@�[I" EXTENDED;To;;[o; ;[I")see Regexp.options and Regexp.new ;T;0@�[I"MULTILINE;To;;[o; ;[I")see Regexp.options and Regexp.new ;T;0@�[I"FIXEDENCODING;To;;[o; ;[I")see Regexp.options and Regexp.new ;T;0@�[I"NOENCODING;To;;[o; ;[I")see Regexp.options and Regexp.new ;T;0@�[ [[I" class;F[[:public[ [I"compile;T@�[I"escape;T@�[I"json_create;F@�[I"last_match;T@�[I"new;F@�[I" quote;T@�[I"try_convert;T@�[I" union;T@�[:protected[ [:private[ [I" instance;F[[;[[I"==;T@�[I"===;T@�[I"=~;T@�[I"as_json;F@�[I"casefold?;T@�[I" encoding;T@�[I" eql?;T@�[I"fixed_encoding?;T@�[I" hash;T@�[I"inspect;T@�[I" match;T@�[I"named_captures;T@�[I" names;T@�[I"options;T@�[I"source;T@�[I"to_json;F@�[I" to_s;T@�[I"~;T@�[;[ [;[