Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Thanks for the additional paragraphs.

The OP's supposition implied that variables could be used there. They can't. That's what I said.

That's not how I read

I would assume that quantifier cannot be a '\x' variable
at all—it seems to me specifically to be saying that you can't use a variable there. Do you mean that, since it mentions that you can't use one sort of variable, it implies that you can use others?

Aside from that, did you forget about capture buffers, the return value of the last (?{ }) and Perl variables? There's just no way to access them there.

You certainly can use, at least in the sense of referring to, capture buffers (which I guess means $1 instead of \1?) and Perl variables, like /(.{$1}){$a}/; since their values don't change during the regex match *, the result is the same (as you pointed out) as substituting in their values before running the regex. (Indeed, I think that's exactly what happens internally.) This is just what I meant in Re: Regex fun; so, as I indicated there, I must (still) be misunderstanding you.

UPDATE: To avoid the appearance of slyly avoiding the bit about the return value of the last (?{ }), I didn't forget about it, but only because I never knew about it. Thanks!

Another UPDATE: * Ah, this is probably a crucial point! I always assumed that $1 didn't change until the match had completed; but I guess it's more accurate to say that it does change, but that all the interpolation has already happened at that point, so that change is not reflected in the regex. There's my misunderstanding; sorry!


In reply to Re^6: Regex fun by JadeNB
in thread Regex fun by Hena

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2021-05-18 14:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (180 votes). Check out past polls.

    Notices?