When asking regex questions, always add the tag for the specific programming language or tool (e.g., Perl, Python, or Java; vi, emacs, or ɢɴᴜ grep; etc.) you are using.

learn more… | top users | synonyms

0
votes
0answers
21 views

Using regex with several locations in nginx

I have dynamic number subfolders of the domain. For example: http://mysite/en/ http://mysite/en-us/ http://mysite/de/ http://mysite/ru/ In general, subfolders look like "en","de","ru" OR "en-us", ...
0
votes
1answer
49 views

apache - query string rewrite rule adds percentage symbol

I've set up a rule to rewrite a query string. Although the redirection is correctly performed, a % character is appended to the rewritten query portion of the URL, like so: ...
1
vote
1answer
31 views

Show real server name in nginx logs and params passed to fastcgi?

I have configured my nginx vhosts with a regex in server_name. nginx shows the raw regex in logs and in params passed to php-fpm (I know there's $_SERVER['HTTP_HOST'] with a real value, that's not an ...
1
vote
0answers
11 views

SED returning error 2 when launched by Wpkg

Case I am deploying a software product using Wpkg over Windows workstations. I need to disable product's faulty automatic update and the best solution in this case is to modify one configuration file ...
-1
votes
2answers
34 views

Fail2Ban Regex - Joomla / PHP5-FPM

i can't get a regex for fail2ban to work. I want to match the following: [Tue Jun 24 10:22:14.528987 2014] [fcgid:warn] [pid 22526:tid 139757615011584] [client IP:PORT] mod_fcgid: stderr: user admin ...
0
votes
1answer
25 views

Postfix Regex Alias with Text Substitution

I'm migrating from an older email structure ([first letter of first name].[last name]@company.com) to [first letter of first name][last name]@company.com. To ensure that mail sent to older addresses ...
0
votes
0answers
20 views

redirect robots.txt to alternative apache mod rewrite [duplicate]

I'm having trouble trying to get an alternative robots.txt to display for different host names so that Google or Bing won't spider different addresses. Here's what I have so far #temporary dev rule ...
0
votes
1answer
30 views

Puppet: Nagios with regex node names

I am configuring a puppet master and want to rely heavily on hiera. Many of my systems will be almost identical due to being scalable. I have therefore created node manifests which use regex rather ...
0
votes
1answer
60 views

Optional URL segments in NGINX

I need to proxy pass multiple segments further to another server, there can be up two 5 segments. What nginx needs to match example.com/somehash example.com/somehash/segment1 ...
1
vote
2answers
105 views

nginx url rewriting. i just don't get it

Ok, an example url is http://www.mysite.com/?p=account&view=settings the p uri is a constant. all urls have it. the view is one of many optional uri. i've tried to understand url rewriting ...
0
votes
2answers
109 views

Zabbix doesn't update value from file neither with log[] nor with vfs.file.regexp[] item

I am using Zabbix 2.2. I have a very specific environment, where I have to generate desired data to file via script, then upload that file to ftp from host and download it to Zabbix server from ftp. ...
1
vote
0answers
38 views

varnish - multiple catch-all domain names

In order to avoid setting up one backed per subdomain, I am specifying a catch-all regex string per domain name, as follows: backend domain1 { .host = "10.10.10.5"; .port = "80"; } ...
1
vote
0answers
33 views

Unable to match expression inside If directive no matter what

I have been trying for the past 3 hours trying to match an if statement to define a variable within httpd.conf with no success: <If "%{HTTP_HOST} =~ /[a-z]+/i"> Define test_value "A" ...
0
votes
0answers
21 views

mod_pagespeed ModPagespeedLoadFromFile ReGex not working

I have following directive in MPS config: ModPagespeedLoadFromFile "^https?://www.(e|i)zi?aro(v|w)k(y|i).(cz|sk|pl)/static/" "/var/www/eZarovky/production/public/static/" This RegExp should match ...
2
votes
1answer
296 views

Apache LocationMatch regex behaviour does not seem correct

I am using the LocationMatch directive to set headers upon matching of certain URL patterns: # 1 # Expected matches: //mysite.com/any-page-with-at-least-a-character-and-no-dot <LocationMatch ...
0
votes
1answer
50 views

Nginx Extract Top Directory Name From Request URI

I am in the need of being able to use top directory from the $request_uri, for example: /dir/sub/slug -> /dir I read the answer of this question: How to extract Only the file name from the request ...
1
vote
1answer
67 views

fail2ban-regex matches with strings, but not with log and conf files, why?

If I run fail2ban-regex '31.22.105.115 - - [11/Apr/2014:18:09:54 +0100] "GET /admin/config.php HTTP/1.0" 301 573 "-" "-"' '^<HOST> - - (?:\[[^]]*\] ...
0
votes
1answer
144 views

Filter python messages with regex in syslog-ng

I have syslog-ng (v3.4.7) configured to catch almost all messages in their respective logs, but recently I've included some python scripts in crontab and their output just goes to messages or debug ...
1
vote
1answer
159 views

Nginx redirect all old domain subdomains to new one

I had a very long domain, so I decided to change it to a shorter and more friendly one. But since I have a lot of subdomains (in fact, I have a subdomain wildcard), I wanted to keep the subdomain ...
1
vote
1answer
184 views

nginx return 301 / redirect

among all 'redirect in nginx' questions I couldnt find how to redirect (using return 301 and beteer no ifs) using regexps. I have a link to my website and I'd like to remove parameter a the end: ...
1
vote
1answer
290 views

fail2ban bad bots apache access log regex

Trying to block some bad bots using fail2ban reading Apache access log and stuck setting up correct regex. The line I want to match in the access log is: 5.10.83.65 - - [18/Mar/2014:09:06:38 +0400] ...
0
votes
0answers
30 views

Issue with a NGINX Location regex

I'm just dealing with a location issue today, I have a customer domain with the following format: subdomain.domain.tld and urls as: subdomain.domain.tld/servicename I'm trying to forward this ...
1
vote
1answer
43 views

Postfix regexp map for mailboxes

I need to forward all email that comes to mailbox by some mask to one specific mailbox. For example if recipient mail is 79001234567 it should be forwarded. line from /etc/postfix/main.cf ...
1
vote
1answer
184 views

Redirect all subdomains to main domain with lighttpd and regex

Is it possible to redirect all *.domain.com to my domain.com? I have been messing around with the Regex but without any luck: $HTTP["host"] =~ ".*\.domain\.com" { url.redirect = ...
0
votes
2answers
561 views

Zabbix 2.0: Regular Expression to extract value from a String for a trigger?

I am using Zabbix 2.0.4 to monitor several Java applications. Most values are exported via JMX. One of those exported attributes is a string that is constructed like this: ...
0
votes
0answers
33 views

Negative match for IP based RegEx

I am looking for negative matching for the below IP based regular expression: True-Client-Ip: ...
2
votes
0answers
36 views

List subfolders somewhere in the path with rsync

I'm developing a program, that will recursively "walk" through Linux repositories, look for PXE-related files and create gPXE configs. I met across a problem with the structure of Ubuntu catalogs on ...
0
votes
1answer
104 views

Sieve: filter subject with regex, file into mailbox named match

I am trying to filter mails by subject with a regular expression. The subjects I want to match are read like [git-foo] some more text where foo is the string I want to check for. I end up with the ...
0
votes
1answer
47 views

Invalidating email addresses from sql dump before import

Synopsis I would like to import production data into the development environment so testing can be done in an almost accurate way. Of course I need to invalidate e-mail addresses as I don't want ...
0
votes
1answer
95 views

Using named groups in a DirectoryMatch directive

I have the following directive in my httpd.conf: <DirectoryMatch ^/path/(?P<SI>[^/]+)/logs/bibi> php_admin_value open_basedir /path/?P=<SI>/ </DirectoryMatch> The ...
1
vote
0answers
90 views

Exchange 2013 Mail flow rule using RegEx

We're trying to implement a rule on certain mailboxes that it shouldn't accept an email without a subject. I found documentation from Microsoft on exchange 2010 to Configure a Transport Rule for ...
0
votes
2answers
40 views

Tinydns data file change ip with bash

I am using tinydns and need to dynamicly change some ip in data file. I want to use bash script for it. For example data file: +sub1.example.org:282.196.222.245:14400 ...
0
votes
1answer
123 views

Whitelisting valid URL patterns on a NGINX webserver

I want to whitelist only valid URL-patterns on our RESTful webserver / API, using regexs or something. But when googling for some examples I get a little bit suspicious since there is not much ...
0
votes
1answer
35 views

Location regex acting weird on NGINX

I come to you today with a super strange comportment on my NGINX reverse proxy. I use it to be the reverse proxy of a tomcat server and set the host configuration like that: server { listen ...
0
votes
1answer
2k views

Nginx location regex is not matching

The following has been working to cache css and js for me: location ~ "^(.*)\.(min.)?(css|js)$" { expires max; } results: $ curl -I http://mysite.com/test.css HTTP/1.1 200 OK Server: nginx ...
0
votes
0answers
85 views

How to exclude a URL from mod-rewrite with nginx?

I'm moving my Joomla! 2.5 from Apache Ubuntu to Debian nginx and I need to exclude some URLs from the mod-rewrite. Now I'm rewrite all within this directive on the IspConfig panel: # mod_rewrite url ...
0
votes
2answers
2k views

Nginx: location regex for multiple paths with backend

I have two locations in nginx config that work: location ^~ /media/ { proxy_pass http://backend.example.com; } location ^~ /static/ { proxy_pass http://backend.example.com; } How can I combine ...
1
vote
1answer
31 views

Rewrite rule when source contains a '?' [duplicate]

Scratching my head on this. I have an old URL: http://myserver/blog/archive?openview&type=Category&key=Demo and a new URL http://myserver/blog/categories/Demo I'm trying to get ...
1
vote
0answers
43 views

How to convert RewriteCond rules so they work in Lighttpd?

How can I convert this Apache rewrite rules so they work on Lighttpd? This is in fact a .htaccess file, and I need to put those in a lighttpd.conf file. Options +FollowSymLinks RewriteEngine on ...
1
vote
1answer
76 views

fail2ban jail not working properly

I'm trying to block non-available script requests to nginx with fail2ban. # Noscript filter /etc/fail2ban/filter.d/nginx-noscript.conf: # # Block IPs trying to execute scripts such as .php, .pl, ...
0
votes
0answers
57 views

Postfix bad notify parameter syntax

Please bear with me as I'm not an expert admin I have a linux mail server that has been running for a couple of years and now all of a sudden a certain user is unable to send emails. They immediately ...
0
votes
2answers
86 views

How do I get check_http -r to look for exactly n instances of a string

I have an URL I can query to make sure that my app is running properly. The results are something like below. Checking that "ok" is in the string does not tell me all is well, I need to know that it ...
0
votes
1answer
345 views

Ngnix Rewrite - If URL contains

I'm having a small issue - my error log is filling up with requests to a directory folder on my site (but with added data that shouldn't be there). http://example.com/the-directory/undefined ...
0
votes
1answer
102 views

NGiNX and MediaWiki rewrite regular expression

I am having some problems with regular-expression with rewrite in NGiNX. Here is my config: location /wiki/ { rewrite ^/([^?]*)/([^?]*)(?:\?(.*))? /$1/index.php?title=$2&$3 last; ...
0
votes
1answer
77 views

Lighttpd, regex in conf, path including regex match

The background : - Lighttpd 1.4.28 - Debian 6.0.7 i686 Several developers are using this web server, and each of them has his own virtual host named after "username.mysite.tld". These hosts are ...
0
votes
0answers
202 views

How to use regexp in haproxy?

I know haproxy can use PCRE (enable USE_PCRE and USE_STATIC_PCRE) or POSIX regexp, and POSIX regexp include BRE (Basic Regular Expression) and ERE (Extended Regular Express). If i install haproxy ...
1
vote
1answer
71 views

Wrangling sed to find and reformat login date (or, how to kill idle mosh-server processes)

I have an old method of killing idle mosh-server processes, which doesn't work on my new VPS. Here's the old method, which I run in root's crontab to clean up mosh processes that have been idle for ...
0
votes
0answers
22 views

Apache 2 rewrite rule expression [duplicate]

I need to make a rewrite rule in an intranet Apache2 (CentOS 6.4) Server. I need to redirect (servername)/(path) to (servername).(domain)/(path) OR (serverIP)/(path) to ...
1
vote
1answer
52 views

Use of backreferences in fail2ban filters possible?

From time to time, I see collections of suspect "File not found" errors in my Apache logs, basically using the pattern File does not exist: /var/www/file, referer: http://my.server.com/file In ...
1
vote
0answers
70 views

Nginx - Adding a trailing slash to urls on HTTPS

I am using the below regex to add a trailing slash to any url that doesn't have a railing slash or ends ends with .. rewrite ^([^.]*[^/])$ $1/ permanent; This works fine for http, but when I use ...