Ruby | Regexp fixed_encoding?() function Last Updated : 13 Sep, 2024 Comments Improve Suggest changes Like Article Like Report Regexp#fixed_encoding?() : fixed_encoding?() is a Regexp class method which checks whether the regular expression is applicable to a string with any ASCII compatible encoding. Syntax: Regexp.force_encoding?() Parameter: Regexp values Return: true - if the rxp is applicable to a string with any ASCII compatible encoding otherwise return falseExample #1 : Ruby # Ruby code for Regexp.fixed_encoding?() method # declaring Regexp value reg_a = /a/ # declaring Regexp value reg_b = /geeks/ # declaring Regexp value reg_c = /a/ # fixed_encoding? method puts "Regexp fixed_encoding? form : #{reg_a.fixed_encoding?}\n\n" puts "Regexp fixed_encoding? form : #{reg_b.fixed_encoding?}\n\n" puts "Regexp fixed_encoding? form : #{reg_c.fixed_encoding?}\n\n" Output :Regexp fixed_encoding? form : falseRegexp fixed_encoding? form : falseRegexp fixed_encoding? form : falseExample #2 : Ruby # Ruby code for Regexp.fixed_encoding?() method # declaring Regexp value reg_a = /geeks/ # declaring Regexp value reg_b = /problem/ # declaring Regexp value reg_c = /code/ # fixed_encoding? method puts "Regexp fixed_encoding? form : #{reg_a.fixed_encoding?}\n\n" puts "Regexp fixed_encoding? form : #{reg_b.fixed_encoding?}\n\n" puts "Regexp fixed_encoding? form : #{reg_c.fixed_encoding?}\n\n" Output :Regexp fixed_encoding? form : falseRegexp fixed_encoding? form : falseRegexp fixed_encoding? form : false Comment More infoAdvertise with us Next Article Ruby | Regexp fixed_encoding?() function M mayank5326 Follow Improve Article Tags : Ruby Ruby-Methods Ruby Regexp-class Similar Reads Ruby | Regexp encoding() function Regexp#encoding() : encoding() is a Regexp class method which returns the encoding value of the regular expressions. Syntax: Regexp.encoding() Parameter: Regexp values Return: encoding value of the regular expressions Example #1 : Ruby # Ruby code for Regexp.encoding() method # declaring Regexp valu 1 min read Ruby | Regexp compile() function Regexp#compile() : compile() is a Regexp class method which completes a new Regular Expression. Syntax: Regexp.compile() Parameter: Regexp values Return: creates a new Regular Expression. Example #1 : Ruby # Ruby code for Regexp.compile() method # declaring Regexp value reg_a = Regexp.compile(/a/) # 1 min read Ruby | Regexp escape() function Regexp#escape() : escape() is a Regexp class method which returns a new string by escaping any characters that would have special meaning in a regular expression. Syntax: Regexp.escape() Parameter: Regexp values Return: a new string by escaping any characters that would have special meaning in a reg 1 min read Ruby | Regexp eql?() function Regexp#eql?() : eql?() is a Regexp class method which matches the character in two regular expression. Syntax: Regexp.eql?() Parameter: Regexp values Return: true - if two regular expressions matches string otherwise return false Example #1 : Ruby # Ruby code for Regexp.eql?() method # declaring Reg 1 min read Ruby | Regexp casefold?() function Regexp#casefold?() : casefold?() is a Regexp class method which returns the value of the case-insensitive flag of regular expressions. Syntax: Regexp.casefold?() Parameter: Regexp values Return: value of the case-insensitive flag of regular expressions Example #1 : Ruby # Ruby code for Regexp.casefo 1 min read Ruby | Regexp ==() function Regexp#==() : ==() is a Regexp class method which compares two regular expressions. Syntax: Regexp.==() Parameter: Regexp values Return: true - if two regular expressions are equal otherwise return false Example #1 : Ruby # Ruby code for Regexp.==() method # declaring Regexp value reg_a = /a/ # decl 1 min read Ruby | Regexp ===() function Regexp#===() : ===() is a Regexp class method which compares the equality of two regular expressions. Syntax: Regexp.===() Parameter: Regexp values Return: true - if two regular expressions has equality otherwise return false Example #1 : Ruby # Ruby code for Regexp.===() method # declaring Regexp v 1 min read Ruby | Regexp =~() function Regexp#=~() : =~() is a Regexp class method which matches a regular expression against a string. Syntax: Regexp.=~()Parameter: Regexp valuesReturn: true - if two regular expressions matches string otherwise return false Example #1 :  Ruby # Ruby code for Regexp.=~() method # declaring Regexp value 1 min read Ruby | Symbol encoding function Symbol#encoding() : encoding() is a Symbol class method which returns the Encoding object that represents the encoding of Symbol. Syntax: Symbol.encoding() Parameter: Symbol values Return: the Encoding object that represents the encoding of Symbol. Example #1 : Ruby # Ruby code for Symbol.encoding() 2 min read Like