Abele Design
Reliable website development and cutting edge design at affordable price.
free quote
Need a website?
Get free quote today!

IT solutions by AbeleDesign Montreal, QC

PHP scripts

CSS example codes

Case studies in SEO and Internet marketing

Knowledge base in PHP, MySQL, Ajax

 

 

 

 

 

Regular expressions

Report filters has pros: quick and relatively easy, can be applied to historical data, will not trigger sampling, Cons: resticted to one report and the data in that report; you might need to know some basic regular expressions.

Analytics and regular expressions

Regular expressions are special operators that match or remove string parts of a field, as well as the rules or logic that govern all characters. Analytics use these expressions to match the data and perform an action when a match is achieved.

Expression
Explanation
Example
.
Matches any single character (letter, number or symbol)
Ex: Bit.man = Bit1man, Bit@man, Bitoman…etc.
*
Matches zero or more of the previous item (or character). using the star means that the previous item doesn't need to be in the search 
Ex: Bit*man = Bitman, Bitrman, Bitrrman and even Biman since the previous item does not need to be in th search.
+
Match one or more of the previous items
Ex: Bit+man = Bitman, Bitrman or Bitrrman. But never Biman.
?
and
Ex: Bit?man = Bit and man
Or
Ex: Bit|man = Bit or man.
Expression
Explanation
Example using Bitman
^
Requires that your data be at the beginning after this field
^Bitman can be Bitman1, Bitmann Bitman@, Bitmanne. But never SBitman.
$
Requires that your data end before this field
Bitman$, is SBitman, #1Bitman,everythingBitman but never Bitmann.

 

Regular expressions are greedy. For example, Bitman matches Bitman and your_Bitman and Bitman_rules!. If Bitman is your regular expression, it is the equivalent of asking to match to all strings that contain Bitman. Therfore, you should use anchors whenever necessary, to get a more accurate match. ^Bitman$, which uses both a beginning ^ and ending $ anchor, will ensure that the expression has to start with Bitman and end with Bitman and include nothing else. So ^Bitman$ = only to Bitman

 

Expression
Explanation
Example using Bitman
()
Use parenthesis to create an item, instead of accepting the default
Bitman(a|o) will match both Bitmana and Bitmano
[]
create a list of items to match to
[A,B,C] = A, B and C
-
Use dashes with brackets to extend your list. Use dashes with brackets to extend your list
[1-9] = 1,2,3,4,5,6,7,8,9
[A-Z] = All Alphabet
Note: The symbol \ turns a regular expression character into an everyday character yahoo\.com keeps the dot from being a wildcard.
Additional RegEx information can be found at Google University: