in reply to (Solved) Extracting sometimes null string from text variable

"Screw elegance!" Go for whatever works, using your actual data. And if more than one regex is required to handle the various cases, who cares?

Also: if you find that you have to use procedural code to compensate for whatever (any ...) regex is calling-out as a match, then you are doing something wrong.

Take a life-lesson from how the venerable awk utility did the same job, forty years ago now . . .

  • Comment on Re: (Solved) Extracting sometimes null string from text variable

Replies are listed 'Best First'.
Re^2: (Solved) Extracting sometimes null string from text variable
by Marshall (Canon) on Sep 18, 2017 at 01:21 UTC
    I like your philosophy.
    There is nothing wrong with my posted code in terms of execution efficiency or understand-ability in terms of my application.

    I see how to do it shorter.
    The solution of using \h gives me pause because it is obscure.
    I wanted to know about this shorter method.
    But that doesn't necessarily mean that I will use it in the production code.

    Update:
    My code snippet is just a very, very minor part of a Web Automation program which visits about 100K+ links. I am working with the webmaster for this site and we are developing new features. With our new features, I will only have to visit a max of 2K max web pages (Not 100k). In general a peep-hole optimization for a few lines doesn't matter much. The huge qains have to do with algorithms adjustments. That stuff can yield 50:1 or even 200:1, a huge performance increase.

      The solution of using \h gives me pause because it is obscure.

      The list of character class escapes in perlre could be improved by better grouping of related character classes.

Re^2: (Solved) Extracting sometimes null string from text variable
by jdporter (Paladin) on Sep 26, 2017 at 15:55 UTC
    if you find that you have to use procedural code to compensate for whatever (any ...) regex is calling-out as a match, then you are doing something wrong.

    More baloney from the baloney man.