s///x

A

Anno Siegel

Dr.Ruud said:
Anno Siegel:

A bit like that yes. It covers adjectives like 'normal', 'usual',
'habitual', 'customary', 'ordinary', 'general', 'common', 'simple',
'just', and most related adverbs too.

I should have known better than to base a translation on the "Dutch is
like German" theory.
It is something my 3 year old answered when she got fed up with me
asking her several times in a row what she meant with 'Gewoon.' (I knew
that she meant "Just because." and she knew that I knew).

Oh well... Pedantic educative questions instead of getting on with
whatever you were doing. You had it coming.

Anno
 
D

Dr.Ruud

Abigail schreef:
[regex without /o]
It doesn't actually check whether a variable has changed - it just
tests whether, after interpolation, the regex has changed. And
compared to actually executing a regex, this test takes insignificant
time. It doesn't weight up against the hard to trace bugs if the
variable does change and the regex doesn't because you used /o.

OK, thanks for confirming that.

My /o's meant that the variables will never change after setup.

Is there an efficient way to use constants in regexes? Maybe not useful
when constants are actually subs.
 
J

John Bokma

Dr.Ruud said:
Is there an efficient way to use constants in regexes? Maybe not useful
when constants are actually subs.

using qr//?

"Since Perl may compile the pattern at the moment of execution of qr()
operator, using qr() may have speed advantages in some situations, notably
if the result of qr() is used standalone:"

(perlop)
 
D

Dr.Ruud

John Bokma:
Dr.Ruud:

using qr//?

"Since Perl may compile the pattern at the moment of execution of qr()
operator, using qr() may have speed advantages in some situations,
notably if the result of qr() is used standalone:"

{perlop)

Thanks John. Abigail already mentioned it, but I didn't look into it
right away and then I just didn't, so now at last I did.

$re{'A01'}[SRCH] = 'some regex, grouping allowed';
$re{'A01')[REPL] = 'some replacement, backtracking allowed';
$re{'A01'}[MODS] = 'xsg';
:
:
$re{'A01'}[QREX] = qr/(?$re{'A01'}[MODS])$re{'A01'}[SRCH]/; #
qompiled regex
:
:
s/$re{'A01'}[QREX]/$re{'A01')[REPL]/;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,268
Latest member
AshliMacin

Latest Threads

Top