The regular expression understanding
overview
it hvae a long time that i havent wrote a blog, recently,i am dealing with a project,which include the regular expression knowledge in perl languge,so what is regular expression ? as the name say, it is not hard understant that regular expression is you define “regular” to do something,because there are lot of pro-artcial to explain the regular expression,so i just write something in my own perspective though the example in case i forget it,let’s break it down
example

$line is a virible in perl,you can define a varible by the $.*
=~ is pattern bindig in perl used to binding regular expression
let us see / ,there are three type of regular expresson in genaral, which is
match regular,m//
replace regular,s///
transliterate regular, tr///
you might get confused about that there isnt the m in this example above ,that is because if the regular expression is m// in perl ,you tatoly can drop it,they are exactly in the same way.
the next is $filename ,is a varible ,that mean to match the value of $filename in $line
the next is \s that means match whitspace
NOTE: you should not see the regular expression seperate,you should see them as whole part,that mean you can not see the current regular expression plus before
so you should see /$filename\s as a whole to match the $line
the next is + that mean the \s whilespace ocurres one or more time
the next is offest,to search offest in $line
the next is \s*,the * and the + are both gread pattern regular expression mean how many times to match
…..
let us see the (\d+)and (\w+),this is a group defined by ().\d means to match number,\wmeans to match the word chracter
the cold above is actually math a line content of a file in my project, the file content just like this bellow
offset = 2 lastlinelength = 5 lastlineinfo = abcd
yeah,you are riht,the code is to serch this format content there is a tutorial might help you to understand https://www.youtube.com/watch?v=sa-TUpSx1JA