⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.133
Server IP:
185.119.109.197
Server:
Linux managedhosting.chostar.me 5.15.0-160-generic #170-Ubuntu SMP Wed Oct 1 10:06:56 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.1.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
ri
/
3.0.0
/
system
/
String
/
Edit File: gsub-i.ri
U:RDoc::AnyMethod[iI" gsub:ETI"String#gsub;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"CReturns a copy of <i>str</i> with <em>all</em> occurrences of ;TI"O<i>pattern</i> substituted for the second argument. The <i>pattern</i> is ;TI"3typically a Regexp; if given as a String, any ;TI"Gregular expression metacharacters it contains will be interpreted ;TI"Mliterally, e.g. <code>\d</code> will match a backslash followed by 'd', ;TI"instead of a digit.;To:RDoc::Markup::BlankLine o; ; [I"OIf +replacement+ is a String it will be substituted for the matched text. ;TI"PIt may contain back-references to the pattern's capture groups of the form ;TI";<code>\d</code>, where <i>d</i> is a group number, or ;TI"9<code>\k<n></code>, where <i>n</i> is a group name. ;TI"GSimilarly, <code>\&</code>, <code>\'</code>, <code>\`</code>, and ;TI"G<code>\+</code> correspond to special variables, <code>$&</code>, ;TI"J<code>$'</code>, <code>$`</code>, and <code>$+</code>, respectively. ;TI"-(See rdoc-ref:regexp.rdoc for details.) ;TI"5<code>\0</code> is the same as <code>\&</code>. ;TI"N<code>\\\\</code> is interpreted as an escape, i.e., a single backslash. ;TI"JNote that, within +replacement+ the special match variables, such as ;TI":<code>$&</code>, will not refer to the current match.;T@o; ; [I"CIf the second argument is a Hash, and the matched text is one ;TI"Dof its keys, the corresponding value is the replacement string.;T@o; ; [I"NIn the block form, the current match string is passed in as a parameter, ;TI"Nand variables such as <code>$1</code>, <code>$2</code>, <code>$`</code>, ;TI"E<code>$&</code>, and <code>$'</code> will be set appropriately. ;TI"-(See rdoc-ref:regexp.rdoc for details.) ;TI"OThe value returned by the block will be substituted for the match on each ;TI" call.;T@o; ; [I"@When neither a block nor a second argument is supplied, an ;TI"Enumerator is returned.;T@o:RDoc::Markup::Verbatim; [ I"?"hello".gsub(/[aeiou]/, '*') #=> "h*ll*" ;TI"C"hello".gsub(/([aeiou])/, '<\1>') #=> "h<e>ll<o>" ;TI"N"hello".gsub(/./) {|s| s.ord.to_s + ' '} #=> "104 101 108 108 111 " ;TI"C"hello".gsub(/(?<foo>[aeiou])/, '{\k<foo>}') #=> "h{e}ll{o}" ;TI"?'hello'.gsub(/[eo]/, 'e' => 3, 'o' => '*') #=> "h3ll*" ;T:@format0o; ; [I"6Note that a string literal consumes backslashes. ;TI"I(See rdoc-ref:syntax/literals.rdoc for details on string literals.) ;TI"HBack-references are typically preceded by an additional backslash. ;TI"KFor example, if you want to write a back-reference <code>\&</code> in ;TI"K+replacement+ with a double-quoted string literal, you need to write: ;TI"<code>"..\\\\&.."</code>. ;TI"IIf you want to write a non-back-reference string <code>\&</code> in ;TI"F+replacement+, you need first to escape the backslash to prevent ;TI"Hthis method from interpreting it as a back-reference, and then you ;TI"Kneed to escape the backslashes again to prevent a string literal from ;TI"3consuming them: <code>"..\\\\\\\\&.."</code>. ;TI"FYou may want to use the block form to avoid a lot of backslashes.;T: @fileI" string.c;T:0@omit_headings_from_table_of_contents_below0I"�str.gsub(pattern, replacement) -> new_str str.gsub(pattern, hash) -> new_str str.gsub(pattern) {|match| block } -> new_str str.gsub(pattern) -> enumerator ;T0[ I"(*args);T@GFI"String;TcRDoc::NormalClass00
Simpan