-
while($line =~ /\b([a-z0-9._-b/isg)\.a-z]/)_email/}
The numbers are similar, divided into two parts to match, and then the conditions are judged, and the upstairs method is also good. It is advisable to make m, consider multiple lines.
-
To be honest, I also studied this for a long time, although I finally figured it out, but this kind of affirmation is definitely not recommended to be used when really programming, the regular is very ingenious, and several symbols are indispensable.
First of all, let's understand the order issue:
As can be seen from the description of Capture Buffers in the Perlre documentation: Capture Buffers are numbered from left to right. That is, for your expression, the outermost is $1, the middle is $2, and the innermost is $3.
But there's one more sentence below:
but inside this construct the numbering is restarted for each branch.
The numbering will start over, i.e. the contents of the previous numbering will be replaced.
# before --branch-reset---after
a ) x ( y ) z | p (q) r) |t) u (v) )z ) /x
Then the program parses the regex and sees the s....ly, so I found [softly], which is $3, and then asked for 0 or more spaces, which happened to be followed by a space, so it was resolved to [softly], which was $2. That's when the key comes in, followed by a simple *.
We all know that * means 0 or more times, but generally there is a leading character in front of it, indicating that you want 0 or more letters, but there are no letters in front of it, and there are a string of expressions, so the program finds that I need 0 or more of this structure (s...).ly) s*, so we can only continue to see if there is such a string later.
So the program then finds [slowly], and the content of $3 is replaced with this, and then the same $2 is replaced with [slowly], and then looks again, until the fourth time, $3 is replaced with [subtly], and $2 is also [subtly], and the search is over, and the program says, you ask for 0 to more than (s...).ly) s* structure of strings, I found you a total of 4 such strings, namely: [softly] [slowly] [surely] [subtly], then $1 is a combination of several such strings, which is the complete [softly slowly surely subtly].
To be honest, it took me 10 minutes to figure this out.,I'm pretty bored.,Sometimes it's better to toss something useful.。。。
-
The specific explanation is as follows:
-Capture. - Match any character.
s -- matches the space.
- Greater than or equal to 0 matches.
softly slowly surely subtly" - all 4 strings have a common feature, which is that there are 3 characters between the characters s and ly, so there can be three"."to make a match, so that you can see that the result of the print should be the first three strings.
Is it because of parse. The path is not included in the @inc? >>>More
Obviously, the programs in the above two positions do not work properly, and the correct one is as follows, push @name dir, $file if (-e"$directory/$file"); >>>More
Question 2. chomp($str=);
my @array=split/[ str; >>>More
First of all, beginners, no foundation is not terrible, because everyone comes from 0 foundation, there is nothing to be afraid of, as long as you pay more than others and study more, then you will accumulate more than others. >>>More
The advantage of multi-core over a single core is that it can really process multiple things at the same time, so if a program wants to get better performance on a multi-core CPU, multi-threading is necessary. However, the use of multi-threading involves the problem of data synchronization between threads, and programmers must coordinate the access and processing of data between programs. However, I don't think the difference between multi-core programming and single-core programming is that it is a matter of thread synchronization, because single-core programming can also use multi-threading, and it also needs to face the problem of thread synchronization. >>>More