no, IMHO any $string can be used as a valid regex like in m/$string/ w/o syntax error.
but if you need a regex datatype to distinguish $scalars use qr// to generate them.
DB<106> $s='abc' => "abc" DB<107> $r=qr/abc/ => qr/abc/ DB<108> ref $r eq 'Regexp' => 1 DB<109> ref $s eq 'Regexp' => "" DB<110> 'xabcx'=~m/$r/ => 1 DB<111> 'xabcx'=~m/$s/ => 1
Cheers Rolf
In reply to Re: Detecting if a string is a regular expression
by LanX
in thread Detecting if a string is a regular expression
by smontsar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |