1

We want to make a report of visitors of a selected set of pages.

So we use "Behavior" > "Site Content" > "All Pages".

We fill in part of the pagenames, so FR_PLT* for pages FR_PLT_01, FR_PLT_02 and so on. This works.

Also for FR_Country*, for pages FR_Country_01, FR_Country_02 and so on. Works fine.

But if we want to combine, so FR_PLT*|FR_Country*, the report is empty.

What's the problem?

2

Use this shortener version of your regular expression

FR_(PLT|Country)

And make sure you are using "regular expression" setting inside the filter.

enter image description here

| improve this answer | |
0

That is a perfectly valid regex that ought to do what you want, so here is my guess: are you opening the advanced filtration area and not switching the match type drop-down from Containing to Matching RegExp?

As a side note, that regex will match what you want, but I suspect not in the way you intend. FR_PLT* matches pages containing FR_PL with or without T on the end, and FR_Country* matches pages containing FR_Countr with or without y on the end. In both cases the match is not case sensitive, so if you had a page under fr_pl it would also match the first regex.

To match FR_PLT with anything after it, you'd use the dot wildcard character: FR_PLT.*. However, since regex matches within the string by default, rather than requiring a match on the entire string, you don't match any more or less with FR_PLT.* than with just FR_PLT.

| improve this answer | |
0

You are mixing/confusing regular expressions with globs. FR_PLT* would work as a glob, but not as a regular expression. As a regular expression it would match:

  • FR_PL
  • FR_PLT
  • FR-PLTT
  • FR-PLTTT
  • ABC-FR-PLT-XYZ
  • etc.

because the star means "zero or more of the last character" and this regular expression appears to be applied in a "find" manner. That means that the match just has to be contained in the string. The equivalent regular expression you actually want is: ^FR_PLT.* where ^ means "starts with" and .* means "zero or more of any characters." In regular expressions the . is the wildcard for "any character", as opposed to globs that use * to mean "any of any character."

Combining your two cases into a valid regular expression could be either of the following:

  • (^FR_PLT.*)|(^FR_Country.*)
  • ^FR_(PLT|Country).*
  • ^FR_(PLT|Country)

They all mean exactly the same thing but the second one is simplified. The | is "or" and the parenthesis are for grouping. The last one omits the .* because the regular expression doesn't have to match the whole thing, it appears to be used in a "contains" context here.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.