Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [regular-expression]

A sequence of symbols and characters expressing a string or pattern to be searched for within a longer piece of text.

2
votes
1answer
34 views

Can I use a rewrite rule to send all requests to a single file?

Can I make a single regular expression for all my RewriteRules? I'm rewriting everything to a single file and this this acts like a front-controller. My example: RewriteRule ^de/kontakt/anfahrt$ ...
1
vote
1answer
20 views

Google analytics URL filter for URLs with multiple specific dates

I work for a news outlet and would like to filter for URLs containing several dates. Each date would have more than one URL associated. For example I would like a filter that catches all of these: /...
0
votes
1answer
23 views

Google Analytics Funnel Goal Funnel using RegEx

I've created goals using Google Analytics to track the number of pageviews and goal conversions. I have 2 goals in mind. First Goal: User made an appointment without going to other sites > Thank you ...
1
vote
1answer
1k views

How to pass a match from the regex in a condition to the rule in .htaccess

I have an .htaccess file with rules like this: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} /apples/* RewriteRule . /page/faqs.php?cat=apples&...
1
vote
0answers
44 views

Google Analytics Regular Expressions Goals with Fragmented Urls

I follow the suggestions of this post: Setting up funnel URLs with regular expressions and in https://regexr.com/ my sample works correctly: The url in question would be like: /cashier\/deposit\/...
2
votes
1answer
565 views

Google Analytics include traffic only from two sub domains filter

I have a site that has cross-domain tracking setup on it for 4 domains. 2 of those are subdomains from one domain. I have been trying to setup a filter for a view that only includes traffic from those ...
2
votes
0answers
40 views

Filtering Google Analytics pages for Uppercase characters

I'm trying to see if users have accessed URLs with uppercase characters. I have gone into Behavior>Site Content>All Pages and am attempting to filter using Regex. However, my syntax is not ...
2
votes
2answers
963 views

combine trailing slashes in analytics

Inside my analytics profile, I have to aggregate data from URLs when they are on separate rows because example.com/path is different from example.com/path/. This is a huge usability headache, so I ...
2
votes
1answer
55 views

.htaccess regex 301 redirect after changing site structure?

I`m trying to convert standard 301 redirects using regexp after several changes of categories structures. How to do this with regular expression? Old -> New http://www.example.com/cat1/cat2/cat3/...
4
votes
1answer
400 views

.htaccess 301 redirect dynamic URL with regex?

How to do this with regular expression? Old -> New http://www.example.com/cat1/cat2/cat3/tool-model-10 -> http://www.example.com/tool/tool-model-10 http://www.example.com/cat1/cat2/cat4/tool-...
2
votes
1answer
166 views

Apache httpd.conf && .htaccess directives written in PCRE?

I look at the directives syntax of Apache configuration files like httpd.conf && .htaccess and I must say it looks quite similar to PCRE syntax (that stand for Perl Compatible Regular ...
1
vote
2answers
265 views

Google Analytics Goal Destination Regex

I'm using a destination goal in Google Analytics to capture region specific success pages (like /en/contact-us/thanks.aspx and /de-DE/contact-us/thanks.aspx), but I would also like to set up a goal ...
2
votes
1answer
162 views

How to regex a url to redirect user

Using the regex and the .htaccess file, I want to redirect users to a certain URL. I want to redirect: http://www.example.com/* but not http://www.example.com/CDadmin/* I have tried the following: ...
4
votes
1answer
52 views

.htaccess rule fails when including $ at end

The Basic Situation We have a server. It has some static files, some simple, "flat" .php and .html pages, but it also has a WordPress install at the document root, meaning that visiting / takes the ...
1
vote
1answer
2k views

nginx location rewrite: match /{?x}, {y}, {?z}. Remove y

I am trying to run CiviCRM with Drupal 7 in a docker container of my own design. Unfortunately, I am running into a problem where for some unknown reason CiviCRM is outputting resource requests ...
-1
votes
1answer
87 views

Advanced GA Filter - What does it do?

I've inherited a website's analytics set up - and there are several filters as in the example below. I'm trying to figure out what they do - but a regex noob.
1
vote
1answer
9k views

How can I get a regular expression to only match an empty string? (In a .htaccess file)

I try to make a regular expression in a .htaccess file, that matches only an empty string. I have tried many things, but it seems like it’s impossible. For example, I tried ^$, but it's looking for ""...
2
votes
1answer
945 views

Google Analytics, filter ALL but a few URL parameters

My sites is being bombarded with new and old URL parameters. At first I tried to add those to the list of excluded URL parameters. With that list now exceeding 200, I wanted to try and use a GA ...
2
votes
1answer
379 views

Are regexp advanced filters in Google Analytics Site Content reports supposed to be case sensitive?

When I apply a Matching RegExp advanced filter to a standard Site Content > All Pages report, the regular expression seems to be ignoring case sensitivity. The screenshot attached shows a very ...
3
votes
2answers
2k views

Apache 2.4 <Directory> with regexp - is the alternation operator broken, or am I confused?

I have several document root directories, /opt/lampp/htdocs/proj1, /opt/lampp/proj2, etc, that have AuthType Basic password protection. I want their uploads sub-directory trees not to require a ...
20
votes
1answer
13k views

Can we use regex in robots.txt file to block URLs?

I have a few dynamic generated URLs. Can I use regex to block these URLs in a robots.txt file?
0
votes
1answer
49 views

301 redirect doersnt work in SERP

I setup a 301 redirect on my root that points to a new domain. When I type the old domain URL into browser 301 works just fine. When I do a keyword search for my site and click on the link it still ...
2
votes
2answers
89 views

301 redirect the home pages but keep sitemap pages same

I have manually redirected my entire site. The only page that's left is the homepage. How do I redirect my homepage to the new site (http://example.com) but keep my sitemaps on the old domain (www....
1
vote
1answer
1k views

Tracking rotating Ads with Google Tag Manager

So at the moment we have our ads setup using event tracking in Google Analytic (Universal) and they are implemented in this format: <a href="example.com" onclick="ga('send', 'event', 'Banner Ad - ...
1
vote
0answers
129 views

Sum of completed and not completed doesn't add up correctly in the Google Analytics API

I have a simple funnel situation. The users start at /start/ . Some of them reach the result at /result/ and obviously some don't. So it seems logical to me that: users who went to the start page = ...
0
votes
1answer
182 views

Regular expression for pages in Google Analytics that matches full words only

I am trying to create a regular expression to see all my landing pages in one search result. This is what I have so far, but this regular expression does not consider the (\W|$)), meaning that I ...
2
votes
1answer
206 views

How do I build a custom report of referral traffic for a set of domains in google analytics?

I am building links for my client's website and need to make a custom report in google analytics to show traffic only of the links i build. I have tried the following: Set up custom report Define ...
1
vote
1answer
739 views

Google Analytics Search and Replace filter including request URI parts that have been exluded

I have a search and replace filter that should "roll up" pages underneath different apps. MY URLs have the structure hostname/app-name/page.htm?query App name could be one of several options. My ...
1
vote
0answers
43 views

Regex isn't honored in mod_security2

SecRule REQUEST_URI "^/(|(.*)/)(lpt1|lpt2|lpt3|lpt4)(/|\.|\?|$)" "t:none,t:htmlEntityDecode,t:lowercase,t:removeWhitespace,block,msg:'X',id:'1000'" SecRule REQUEST_URI "^(.*)//(.*)$" "t:none,t:...
3
votes
1answer
242 views

Standard Wordpress mod_rewrite rules interacting with one of my own rules are causing all requests for a certain page to be sent to the homepage

I have WordPress 3.5.1 installed on Ubuntu 12.04 LTS. I'm running Apache 2.2.22. NOTE: I can't share the domain that I'm working on, and must santize any config files and log outputs. While the ...
2
votes
1answer
2k views

Redirecting one page to HTTPS, and all others back to HTTP isn't working as expected

I have WordPress 3.5.1 installed on Ubuntu 12.04 LTS. I'm running Apache 2.2.22. NOTE: I can't share the domain that I'm working on, and must santize any config files. While the website is public, ...
1
vote
1answer
72 views

List of events triggered on pages matching regex

Is there a way to get the grouped list of events (such as in Top events) which were triggered on pages matching a regular expression? I may add the Page secondary dimension in Top events and apply ...