RegEx is a short for Regular Expressions. It is a sequence of characters to define a search pattern. It comes in handy when you have to find or match a large number of strings based on a pattern.
Following a question that was asked by a student enrolled in Advanced Google course.
If I have to exclude and/or include the following IPs form my GA views.
172.11
172.22
172.33
172.44
172.55
Which of the following format do I need to follow in the views’ filter?
172\.11\.*|172\.22\.*|172\.33\.*|172\.44\.*|172\.55\.*
Or,
172.11.|172.22.|172.33.|172.44.|172.55.
Or,
172.11 – Regex: ^172\.11\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$
172.22 – Regex: ^172\.22\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$
172.33 – Regex: ^172\.33\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$
172.44 – Regex: ^172\.44\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$
172.55 – Regex: ^172\.55\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$
Do you know the answer? Well if not then try this free resource to try out all these RegEx options https://regex101.com/