Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I contend that (?{ }) is not a regular expression, but a hook (a place for a Perl expression) to be evaluated by the regex engine during its matching work.

The phrase "Regular Expression" is a mathematical concept predating perl and emacs and sed. Quoting from Freidl's Mastering Regular Expressions:

    The Origins of Regular Expressions

    The seeds of regular expressions were planted in the early 1940s... Through the 1950s and 1960s, regular expressions enjoyed a rich study in theoretical mathematical circles... Ken Thompson's 1968 article Regular Expression Search Algorithm... led to his work on qed, an editor that formed the basis for the Unix editor, ed.

Regular expressions are expressions that regulate a sequence as belonging to a set, or not belonging to a set. (What, you thought 'regular' as in 'everyday' or 'fixed interval'?)

Since (?{}) doesn't fail and cause the engine to backtrack or bail, it's not regulating anything. The regex syntax handles the wrapping stuff but the contents are what's doing the string-modifying, and the results have no direct bearing on the regulation. That's what I mean when I say that (?{}) is not a regular expression.

(I know, I'm forever editing and extending my comments with afterthoughts rather than creating new followups.)
--
[ e d @ h a l l e y . c c ]


In reply to Re: Re: Re: A Perl aptitude test by halley
in thread A Perl aptitude test by Jonathan

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 How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-23 22:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found