Questions tagged [qr-operator]
4 questions
14
votes
3 answers
How can I create a qr// in Perl 5.12 from C?
This has been working for me in 5.8 and 5.10, but in 5.12 my code creates this weird non-qr object:
# running "print Dumper($regex)"
$VAR1 = bless( do{\(my $o = '')}, 'Regexp' );
Whereas printing a qr// not created by my code looks like this:
#…

kris
- 23,024
- 10
- 70
- 79
6
votes
3 answers
How to add a modifier to a quoted regular (qr) expression
Is there an easy way to add regex modifiers such as 'i' to a quoted regular expression? For example:
$pat = qr/F(o+)B(a+)r/;
$newpat = $pat . 'i'; # This doesn't work
The only way I can think of is to print "$pat\n" and get back…

dividebyzero
- 1,243
- 2
- 9
- 17
6
votes
2 answers
Perl qr// and substitution
I'm writing a tiny program that takes user input using Getops, and based on it, the program will either try to match a pattern against some text, or substitute text for what matched.
The problem I'm having is that I can't get the substitution…
user107498
5
votes
3 answers
What characters must I escape in a Perl pre-compiled regex?
I'm having a hard time determining what characters must be escaped when using Perl's qr{} construct
I'm attempting to create a multi-line precompiled regex for text that contains a myriad of normally escaped characters (#*.>:[]) and also contains…

Erik Johansen
- 130
- 2
- 8