cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

This product reached the end of support date on March 31, 2021.

Transaction Step Wildcarding - Which is most efficient?

benjamin_johnso
Organizer

Hello, I'm wondering which of the following is more efficient for the report servers to process?

Lets say I have

http://online.brand1/login
http://brand2-online/login

I want both to match the step rule, I could do

http://*online*/login
http://*/login
*/login

Thanks,
Ben

4 REPLIES 4

Babar_Qayyum
DynaMight Leader
DynaMight Leader

Hello Ben,

I guess it should be like below:

(http://.*/)login

Regards,

Babar

Thanks, as it is a transaction step in the CAS, I just select operation and then use the string:

http://*/login

I just wan't sure if wildcarding everything before the URI would be quicker for the CAS to process?

Babar_Qayyum
DynaMight Leader
DynaMight Leader

Hello Ben,

There should not be an issue to process for the CAS.

I am writing the below information regarding the 'Best Practices for Regular Expressions'.

Use of regular expressions significantly increases the computing load on the AMD and may significantly affect performance, so unnecessary use of regular expressions or use of overly complicated regular expressions should be avoided.
Do not use the match anything expression (a period followed by an asterisk “.*”) unless necessary.

Regards,

Babar

Steven_Monroe
Inactive

Hello Ben,

General regex performance

A large factor in regex performance is how early your regex terminates for non-matches. Arguably one of the best ways to accomplish this is with more specificity in your regex (e.g. more literal characters). Arguably the worst way to go about regex performance is by using wildcards. Before using the .* or .+ wildcards you should always consider if you can replace them with something more specific.

If you absolutely need the wildcard, at least include as many literal characters in front of it as possible. This will help weed out non-matches before they reach the costly wildcard.

Thoughts on your regexes

As for the regexes you listed we cannot definitively say which will perform best because it partially depends on the input. But here are my thoughts. Your first regex has more literal characters than the rest so that is good, but it has TWO wildcards - that is not good. Because of the two wildcards your first regex is almost certainly the least efficient.

For your second and third regexes, I would say the second is better because it has more literal characters. However it's noteworthy that in the case that all of your inputs start with http:// then the third regex is really no less efficient because your second regex is not rejecting any more matches with its literal characters if every input has them anyway.

TL;DR

More literal characters is good. More wildcards is bad. Replace wildcards with literals when possible or at least try to lead the wildcard with as many literals as possible

There are a ton of other things to say about regex performance but these are probably the most critical concepts.

Hope that helps,

Steve