/* * call-seq: * rxp === str => true or false * * Case Equality---Synonym for <code>Regexp#=~</code> used in case statements. * * a = "HELLO" * case a * when /^[a-z]*$/; print "Lower case\n" * when /^[A-Z]*$/; print "Upper case\n" * else; print "Mixed case\n" * end * * <em>produces:</em> * * Upper case */ VALUE rb_reg_eqq(re, str) VALUE re, str; { long start; if (TYPE(str) != T_STRING) { str = rb_check_string_type(str); if (NIL_P(str)) { rb_backref_set(Qnil); return Qfalse; } } StringValue(str); start = rb_reg_search(re, str, 0, 0); if (start < 0) { return Qfalse; } return Qtrue; }