Perl is still the leader, almost the standard, when it comes to
regular expressions. However it also possesses some lesser known
features that deserve special attention, like the embedded code
constructs for runtime code evaluation. Let's find out what Perl regular
expressions are really like with Perl inside.
How does Perl let you mix code and regular expressions?
It provides the (?{ code }) construct which essentially allows for embedding Perl code that gets executed upon every match of the pattern, inside the regular expression.
For example, let's say we have a file that is about to be distributed to multiple platforms/Operating Systems therefore its file name needs to be portable and compatible with the various OSs' file systems. What is the best way to achieve this?
full article on i-programmer
How does Perl let you mix code and regular expressions?
It provides the (?{ code }) construct which essentially allows for embedding Perl code that gets executed upon every match of the pattern, inside the regular expression.
For example, let's say we have a file that is about to be distributed to multiple platforms/Operating Systems therefore its file name needs to be portable and compatible with the various OSs' file systems. What is the best way to achieve this?
full article on i-programmer
Comments