```{index} single: is_regexp; re function ``` ```{index} single: re::is_regexp; Perl function ``` # is_regexp Return true if the argument is a compiled regular expression. Unlike `ref` or `UNIVERSAL::isa`, this function sees through blessing and overloading — it looks at the value's internal type tag, so a `qr//` blessed into another class, or an object with a stringification overload, is still correctly recognised. ## Synopsis ```perl use re 'is_regexp'; if (is_regexp($value)) { ... } ``` ## What you get back The same true / false values Perl uses everywhere else: `&PL_sv_yes` (the canonical true) or `&PL_sv_no` (the canonical false-but-defined). ## Examples ```perl is_regexp(qr/foo/); # true is_regexp("not a regex"); # false is_regexp(\"not a regex"); # false — scalar ref, not a qr// my $blessed = bless qr/foo/, 'My::RE'; is_regexp($blessed); # true — sees through the bless ``` ## Edge cases - Called with zero or more than one argument — croaks with `Usage: re::is_regexp(sv)`. - Non-reference scalars — always false. - References that aren't `qr//` (arrayref, hashref, coderef, scalar ref) — always false.