Perl provides an alternative (?:. . . ) form of parentheses that supports grouping in regular expressions
Question:
Perl provides an alternative (?:. . . ) form of parentheses that supports grouping in regular expressions without performing capture. Using this syntax, Example 14.57 could have been written as follows:
What purpose does this extra notation serve? Why might the code here be preferable to that of Example 14.57?
Transcribed Image Text:
if (/^([+-]?) ((\d+)\.I(\d*)\. (\d+))(?:e([+-]?\d+))?$/) { # floating-point number print "sign: print "integer: ", $3, $4, "\n"; print "fraction: print "mantissa: " print "exponent: ", $6, "\n"; ", $1, "\n"; $5, "\n"; $2, "\n"; # not $7 %3D
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 71% (7 reviews)
Capturing subexpressions takes time In an inner loop the cost of unneces...View the full answer
Answered By
Collins Omondi
I have been an academic and content writer for at least 6 years, working on different academic fields including accounting, political science, technology, law, and nursing in addition to those earlier listed under my education background.
I have a Bachelor’s degree in Commerce (Accounting option), and vast knowledge in various academic fields Finance, Economics, Marketing, Management, Social Science, Women and Gender, Business law, and Statistics among others.
4.80+
4+ Reviews
16+ Question Solved
Related Book For
Question Posted:
Students also viewed these Computer science questions
-
An alternative form of the S-R latch has the same structure as Figure 20.22 but uses NAND gates instead of NOR gates. a. Redo Table 20.10a and 20.10b for S-R latch implemented with NAND gates. b....
-
An alternative form of estimation is accomplished through the method of moments. The method involves equating the population mean and variance to the corresponding sample mean x and sample variance s...
-
As an alternative alphanumeric code, consider a code where punched holes in the columns of a card represent alphanumeric codes. The punched hole represents a 1; all other bits are 0. The Hollerith...
-
Suppose you have a subject property with a 105,000 sq. ft. lot and existing improvements for which you estimate the reproduction cost new to be $2,500,000, physical deterioration to be $400,000,...
-
Liquid water enters an adiabatic piping system at 158C at a rate of 3 kg/s. It is observed that the water temperature rises by 0.3C in the pipe due to friction. If the environment temperature is also...
-
A cantilever beam is embedded at its left end and free at its right end. Use the Laplace transform to find the deflection y(x) when the load is given by Wo. 0
-
In a condenser, to check the leakage of air, the following procedure is adopted: After running the plant to reach the steady conditions, the steam supply to the condenser and also the air and...
-
Rasmussen Corporation expects to incur indirect overhead costs of $80,000 per month and direct manufacturing costs of $12 per unit. The expected production activity for the first four months of 2017...
-
A company issued, 8 years ago, bonds with an annual coupon rate of 8% and a face value of $1000. The coupons are semi-annual and the maturity at the time of issue was 20 years. a. If the...
-
Merrifield Post Office is evaluating the productivity of its mail processing centers. The centers differ in the degree of automation, the type of work that can be performed, and the skill of the...
-
Consider again the sed code of Figure 14.1. It is tempting to write the first of the compound statements as follows (note the differences in the three substitution commands): Explain why this doesnt...
-
Write a Perl script to find, for each input line, the longest substring that appears at least twice within the line, without overlapping.
-
Sketch the region bounded on the left by x = 1, bounded above by y = 1/x, and bounded below by y = -1/x. (a) Find the centroid of the region for 1 x 6. (b) Find the centroid of the region for 1 x ...
-
What is the major long-term regulatory reform that the U.S. Department of the Treasury has proposed?
-
The Euro is currently trading against the Singapore dollar at a rate of 1 = S$1.5. What is the rate for S$1 in ?
-
Explain expenditure-reducing as a means to correct a current account deficit.
-
The following excerpt appeared in the January 14 , 1991 , issue of Wall Street Letter. The Philadelphia Stock Exchange plans to list the first nondollar denominated options to trade in the United...
-
With the exchange rate above, what would be the cost in Singapore dollars of a good that was selling for 150.
-
Review Conceptual Example 7 before solving this problem. Suppose that unpolarized light of intensity 150 W/m2 falls on the polarizer in Figure 24.23a, and the angle u in the drawing is 30.0. What is...
-
A circular concrete shaft liner with Youngs modulus of 3.4 million psi, Poissons ratio of 0.25, unconfined compressive strength 3,500 psi and tensile strength 350 psi is loaded to the verge of...
-
A signal with 200 milliwatts power passes through 10 devices, each with an average noise of 2 microwatts. What is the SNR? What is the SNRdB?
-
A computer monitor has a resolution of 1200 by 1000 pixels. If each pixel uses 1024 colors, how many bits are needed to send the complete contents of a screen?
-
A file contains 2 million bytes. How long does it take to download this file using a 56-Kbps channel? 1-Mbps channel?
-
Direct materials Fixed manufacturing overhead costs Sales price Variable manufacturing overhead Direct labor Fixed marketing and administrative costs Units produced and sold during the quarter...
-
Provide documentation of a step by step training plan for a beta fish. What will be the primary reinforcer? How will you cue the behavior? What schedule of reminforcement will you use. What is the...
-
On May 1, Soriano Company reported the following account balances along with their estimated fair values: Items Carrying Amount Fair Value Receivables Inventory Copyrights Patented technology Total...
Mathematical Recreations From The Tournament Of The Towns 1st Edition - ISBN: 1032352922 - Free Book
Study smarter with the SolutionInn App