Skip to main content

Advanced Perl Regular Expressions - Extended Constructs

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

Comments

Popular posts from this blog

RAG from Scratch

  The "RAG from Scratch" tutorial by Langchain coupled with the "RAG playground" are two great educational resources that will help you kickstart your journey with RAG. https://www.i-programmer.info/news/105-artificial-intelligence/17676-rag-from-scratch.html

Hour Of Code 2024 Is About To Kick Off

  This year the event that aims to provide a coding experience for all school students and anyone else who wants to join in runs between December 9th and 15th and includes new activities. Let's find out all about it! https://www.i-programmer.info/news/150-training-a-education/17664-hour-of-code-2024-is-about-to-kick-off.html