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
1answer
22 views

nginx regex configuration for 404 images

I have dynamic link series like below; http://example.com/users/1871233/18712443_cover.jpg Only static thing is on that link is example.com/users and _cover.I want to make that ; when requested is ...
1
vote
1answer
68 views
+50

nginx rewrite regex for API versioning

What I want is for the first to be turned into the second.. /widget => /widget/index.php /widget/ => /widget/index.php /widget?act=list => ...
-2
votes
1answer
15 views

zsh substitution, can't do regex with repetition

I'm trying to perform ZSH variable substitution, but I'm having to do it the lame way, by piping through cut. Is it possible to perform this operation entirely within ZSH? ...
0
votes
0answers
18 views

Graylog2 date extractor from tab-delimited file

I have a tab-delimited logs with such messages: 2014-06-01 00:00:56 192.168.1.1 968 http://yandex.ru I can extract date and time with regexp (\d{4}-\d{2}-\d{2}\s*\d{2}:\d{2}:\d{2}) but when I ...
1
vote
1answer
39 views

Nagios plugin check_snmp_int does not match regular expression

I am using nagios plugin check_snmp_int with -n switch. Help show: -n, --name=NAME Name in description OID (eth0, ppp0 ...). This is treated as a regexp : -n eth will match eth0,eth1,... ...
0
votes
1answer
54 views

Matching %ff in Nginx rewrite rules

I have some dubious requests coming into my server that contain %ff and %FF (e.g., /blog/%ffupdates/. I'm getting thousands of these daily and would like to start redirecting them to a 403. I ...
0
votes
2answers
49 views

How to print regex match

My problme is two fold. First is printing a regex match. The second is the actual regex. Problem 1: I'm trying to print the output of yum grouplist --verbose into a format that I can put into a ...
0
votes
2answers
75 views

apache - query string rewrite rule appends condition to URL

In trying to rewrite site-search.html?searchword=search%20term as advanced-search#q=search%20term I always end up with advanced-search#q=%3Fsearchword%3search%20term The %3Fsearchword%3 ...
0
votes
0answers
36 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
70 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
46 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
15 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
86 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
34 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
39 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
113 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
172 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
148 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
59 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
37 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
28 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
576 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
70 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
121 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
279 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
307 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 ...
2
votes
1answer
334 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
429 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
34 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
55 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
256 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
807 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
35 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
37 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
170 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
49 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
127 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
111 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
48 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 ...
1
vote
1answer
159 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
51 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
3k 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
109 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
3k 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
33 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
45 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
85 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
66 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
117 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 ...