The plus sign is another handy character you will use when working with regular expressions in Google Analytics.
It’s function is to match one or more of the previous items in the regular expression. Much like other regular expressions, this could either be a character or a mix of characters and code contained in brackets of one kind or another. Most often, it would be a character!
Examples of Plus Sign usage in regular expressions
I gave a similar example when looking at question marks in regex. At my
work, we use campaign tracking to identify our affiliate traffic, particularly where we are testing different CTAs on the affiliate’s site. Working in an international environment, we see a lot of different spellings of
affiliate being captured! affilliate, afiliate, affiliat, etc.
The plus sign could be used in this instance to capture the following:
The code would be: Af+il+iate
Remember that the plus sign will match one or more of the previous item. So in the example I have given above, the following would also match:
If you need to be precise about how many ‘f’s or ‘l’s you want to capture, then the plus sign is not the regex for the job, and the question mark would serve you much better in this example.
Like question marks and a few other special regex characters, the plus sign has a tendency to turn up in google analytics of their own accord. If you’re doing CPC you may have seen plus signs in your keywords reports for example. For details on how to prevent the plus signs you want to be normal behaving as regular expressions, see the link below to my article about backslash.
Have you got examples of using plus signs, or anything else that you would like to share? Please leave a comment below.
Links to the rest of the series:
RegEx 1: Introduction
RegEx 2: Pipe
RegEx 3: Brackets
RegEx 4: Question Mark
RegEx 5: Backslash
RegEx 6: Plus Sign – You are here!
RegEx 7: Dot
RegEx 8: Star
RegEx 9: Dot Star
RegEx 10: Caret
RegEx 11: Dollar Sign
RegEx 12: Square Brackets
RegEx 13: 5 Great Places to use RegEx