Skip to main content

Advanced Perl Regular Expressions - The Pattern Code Expression

In this part of our series exploring Perl RegEx we are going to look into another advanced construct, that of the pattern code expression ??{code}. According to the official perldoc this "..is like a regular code expression, except that the result of the code evaluation is treated as a regular expression and matched immediately."
We will also attempt to combine it with the ?{code} code evaluation expression, covered in the first part of the series.

We'll build on the same scenario, in which we were receiving a serialized stream from a web service that had all special characters encoded in HTML entity hex encoding. The requirement was to convert them back to their actual character representation, for example '£' would become the pound £ symbol). Additionally we are going to search for files that contain the decoded string in their names.

read 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