Regular Expression speed


#1

I’d picked up a Regular Expression reference a few years back when they were first mentioned as a coming PanX feature, but hadn’t found time to read it until recently. I’m still learning, but have gotten some things to work. My impression so far is that complicated selections on a field via Regexmatch, etc run significantly faster than selecting via multiple more conventional operations combined via and/or etc. Checking to see if the field matches one of a text array equivalent via Regexmatch also seems to be significantly faster than using arraycontains( to make the comparison.

Is this relatively speedy performance to be expected? If so I’ll be looking for more places to retrofit my code with it! The downside is that although setting regular expression patterns is easier than it looks, there is a learning curve. Still, getting really complex boolean selections to work as intended isn’t simple either. If you can figure the one you ought to be able to figure the other. Power plus speed should motivate those needing complex selections to learn new tricks.

Some patterns come free. A new medicare number format came out. I found a regular expression pattern to validate it via a quick google search. It works great, but would be beyond my present skill to create from scratch. Regular expressions are an old technology, even by Panorama standards. I bet many canned solutions for common problems are within Google’s reach.


#2

I think that would really have to be evaluated on a case by case basis.

By the way, some Panorama functions use regular expressions internally. So in some cases you may actually be using regular expressions without realizing it (and before you ask, I do not have a handy list of what functions do this, nor any easy way of compiling such a list).

Absolutely. There are also “cookbooks” available that are full of regular expression solutions (as in actual books, available on Amazon).