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 (1)

2
votes
1answer
20 views

Apache2 LocationMatch allow an index for login but nothing else?

I want to allow /myapp and /myapp/ but disallow everything else. How do I configure this? I tried this: <LocationMatch "^/myapp/.+$"> LDAP here </LocationMatch> Which I would assume ...
2
votes
1answer
55 views

htaccess regex not processing URLs properly

I'm trying to redirect (or 'rewrite') over 3000 urls for a site where we updated the SEF of most of the content pages to remove an ID number that was not needed/desired. This should be a simple ...
2
votes
1answer
2k 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: ...
2
votes
1answer
482 views

Regexp in HAProxy's reqrep for asset management

I'm hosting assets on S3 with this kind of URL: http://cdn.site.com/image.jpg In my application I automatically serve versioned URL to force browser to download new files after the deployment: ...
2
votes
1answer
1k views

nginx regex characters that require quoting?

So I was configuring nginx today and I hit a weird problem. I was trying to match a location like this: location ~ ^/([0-9]+)/(.*) { # do proxy redirects } ...for URLs like ...
2
votes
1answer
188 views

Logcheck: wildcards which include non-latin characters

On my mail server, I have a custom logcheck rule as follows, which is intended to filter messages from deliver: ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ deliver\.*\): msgid=.*: saved mail to.*$ ...
1
vote
1answer
140 views

postfix header_checks - regex spanning multiple lines

I would like to create a spam filter that spans multiple lines in headers. This is my /etc/postfix/header_checks file: /^From:.*name[0-9]+@.+[\r\n]+To:.*name@domain\.com/ REJECT It's a valid ...
1
vote
1answer
172 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
1answer
195 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, ...
1
vote
1answer
97 views

Problematic Mail Sieve rules

I need top classify my incomming emails using this three rules: if the email was send to any @somedomain.tld, then copy that email to "somedomain_tld" if the email was send to any other @*.tld , ...
1
vote
1answer
592 views

RewriteRule: cannot compile regular expression. Version support?

I'm running an Ubuntu 10.04 LTS, Apache version 2.2.14. On httpd.conf I've a rewrite rule that look like this: RewriteRule (*UTF8)^/users/([^/])([^/]+)/(.*)$ /users/$1/$2/$1$2/$3 [L] The idea ...
1
vote
1answer
208 views

htaccess for wildcard subdomains

How to translate the example URL to the needed one? From http://test.at.domain.com To http://domain.com/at/index.php?at=test I have: RewriteEngine on RewriteCond %{HTTP_HOST} ...
1
vote
1answer
417 views

Moving mod_rewrite rules in .htaccess to httpd.conf

I've got a massive set of URL rewriting rules that I am trying to: optimize transition to use within httpd.conf But I'm facing problems in getting the final product to work. Note: There are ...
0
votes
1answer
15 views

puppet node name with regex

I am running puppet 3.7.3 on a windows 8.1 client and it is pulling in my default node definition. I am trying to create a more generalized definition by using regex on a group of nodes. Our naming ...
0
votes
1answer
9 views

Failure htaccess regax

I'm trying to get all request to the server to go to the index.php file with the request information. Also, I want to prevent accessing the index.php file directly. The second part works fine but I ...
0
votes
1answer
153 views

Nginx - redirecting non-www to www, but not subdomains

I have many domains linked to the same php directory, and I need all of them to redirect from non-www,non-https to www,https. # Add www, if missing server { server_name ...
0
votes
1answer
206 views

sudo : wildcard in user/group name

I try to find a solution about a sudo problem. I need to push different sudoers files on different servers, depending on the users present on the servers. But I would like to know if I can avoid that ...
2
votes
0answers
332 views

nginx subdirectory to subdomain icingaweb2

I currently have icinga2 set up with the new icingaweb2 ui. it defaults to the subfolder /icingaweb as follows: location ~ ^/icingaweb/index\.php(.*)$ { # fastcgi_pass 127.0.0.1:9000; ...
2
votes
0answers
47 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 ...
1
vote
0answers
10 views

Apache rewrite not finding path

I am trying to rewrite an internal path for specific requests. I have the following URL: ...
1
vote
0answers
30 views

rsyslog regex global modifier

Many regex systems have the ability to set a global modifier to allow for multiple matches. Here's how it works in Javascript and Perl. /g Python is a little different Python doesn’t have a ...
1
vote
0answers
37 views

Apache2 mod_rewrite, handling the optional “/” at the end of a URL

I am attempting to host a single custom page to set as my homepage on my server. The real path to the page is example.com/start.html. However, I do not want this ugly URL in my homepage so I am ...
1
vote
0answers
39 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
vote
0answers
179 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
58 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" ...
1
vote
0answers
233 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 ...
1
vote
0answers
65 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
0answers
142 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 ...
1
vote
0answers
219 views

Multi-line regex replacement in apache

I need to do multi-line replacement in apache2, an mod-substitute only does single line matching AFAIK. I need to be able to do something like this: replace <script> foo = x; bar = y; alert(x ...
1
vote
0answers
118 views

PHP UTF-8 bondary regex does not work

I have a CentOS 6 with newest updates running a LAMP stack. A user is complaining that his code does not work and he is trying to use preg_match with unicode characters. This is the code not ...
1
vote
0answers
542 views

Squid Random Shared ip proxy

Running Squid with a acl random ip setup, Have 745 ip's in the pool and we are about 10 users that use it with tools that are running multiple threads, Check rankings on Google etc Issue: We did ...
1
vote
0answers
485 views

Apache LocationMatch does not work for group

I would like to configure Apache to proxy mldonkey running at localhost. Initially I have used the following configuration (in server config): <IfModule mod_proxy.c> <LocationMatch ...
0
votes
0answers
9 views

Remove .php extension only in certain directory - web.config

I'm having trouble making the pattern for matching the urls in a certain directory. I want to redirect users from mysite.com/posts/some-post.php to mysite.com/posts/some-post meaning that I want to ...
0
votes
0answers
13 views

Nginx return status code from regex grouping

How can I have nginx return a status code from a regular express match? location ~* "^/([\d]{3})" { return $1; } Returns an error 'invalid return code "$1"' I'm trying to setup a test ...
0
votes
0answers
15 views

Removing query strings for a certain location

I am using nginx, and I want to remove query strings on a request in such a way that: With this code, it's not happening. I get a 404 on /store/name. /store/name?page=1 becomes /store/name location ...
0
votes
0answers
18 views

How to pass parameter when using apache mod headers SetEnvIf

I'm new to apache proxy regex - mod_headers and would like to know the following I'm trying to Set and Environmental if the value field of a Request header 'Referer' matches like this: SetEnvIf ...
0
votes
0answers
23 views

nginx rewrite url issue

Current rewrite URL : rewrite ^/link/(.*)/(.*)/(.*)/$ /link.php?one=$1&two=$2&three=$3 last; What I need is solution so three link samples work: 1) /link/one/ 2) /link/one/two/ 3) ...
0
votes
0answers
78 views

systemd logcheck rule not working

given is this logcheck rule: ^\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ systemd-logind\[[[:digit:]]+\]: New session [[:digit:]]+ of user [^[:space:]]+\.$ and this log entry: Mar 19 09:16:09 horst ...
0
votes
0answers
89 views

Regex based Transport rule is too aggressive

I am trying to create a transport rule in Exchange 2010 to filter credit card numbers. Regex support for transport rules is limited as per TechNet. The output from Get-TransportRule "credit card ...
0
votes
0answers
117 views

Apache: Regex to log only last IP in X-Forwarded-For

I'm attempting to set up Apache 2.2's logging to record the last IP passed to it by the X-Forwarded-For header. I want to record the last IP from the X-Forwarded-For header if it exists and the ...
0
votes
0answers
72 views

Finding and renaming directories by regex in linux

I'm trying to match (and later rename) directory names like: A0000 (SOME-NAME) A0001 (SOME-OTHER-NAME) A0001 (ANOTHER-NAME) I'm testing to see if I match any using the find command but doesn't seem ...
0
votes
0answers
62 views

Fail2ban apache-myadmin regex

I've got a jail set up with the following regex, which I took from a standard filter file: apache-myadmin.conf failregex = ^[[]client <HOST>[]] File does not exist: *myadmin* *\s*$ ...
0
votes
0answers
156 views

How to update multiple registry key values using regex?

I am looking for a way to use regex in reg add command in order to update multiple registry key values. Is there any way to do this? reg add "HKEY_USERS\.DEFAULTS\Control Panel\Desktop" /v ...
0
votes
0answers
66 views

Regex validation : simple hotlink prevention while allowing search engines (and their localized versions)

I made and tested a simple hotlink prevention .htaccess and wanted to validate it here before putting it in production. <IfModule mod_setenvif.c> SetEnvIf Referer mysite\.com|localhost ...
0
votes
0answers
60 views

php-fpm: Maintain php_mod logging format

I recently switched all my lab servers from apache pre_fork/mod_php to apache worker/fcgi/php-fpm, and after getting everything set-up correctly, I noticed one last issue; php-fpm is adding it's own ...
0
votes
0answers
10 views

mod_rewrite: Use Substitution from Previous Condition

I'm trying to do a basic language redirect based on a cookie. To do that and prevent a loop, I need to check that the user isn't already on the correct URL, so I wrote this rule: RewriteCond ...
0
votes
0answers
302 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 ...
0
votes
0answers
64 views

Negative match for IP based RegEx

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

htaccess Rewrite leading zero in url causing trouble

I have a database with a string column made up of four unique digits attached to each record. I know this isn't the best way to do this but I'm kind of stuck with it. I'm trying to rewrite urls from ...
-1
votes
0answers
23 views

Nginx and Regex: Can it do what I want?

Consider the following request string: http://<website>/<LotsOfOtherInformation>;SetCamera:Camera5-SetText:TextField1:$sometextinput$-SetText:TextField2:$somedifferenttextinput$ There's ...