Questions tagged [regex]

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.

720 questions
2
votes
1 answer

Procmail Filtering From and Body

I have a script generated e-mail which comes in hourly. I do not need to see it except under certain conditions, and so I just want it filtered to its own mailbox. The message comes from cron, and I want to be careful not to filter out other cron…
David
  • 43
  • 3
2
votes
2 answers

Fail2ban regex doesn't match my log

I'm trying to create a failregex in Fail2ban to find these lines ( and IP addresses ), but I can't write it. My log lines looks like these: [Thu Sep 22 10:28:32.215159 2016] [:error] [pid 1616] [client 83.143.240.13:54895] FastCGI: server…
Feriman
  • 142
  • 7
2
votes
1 answer

mod_rewrite with multiple QUERY STRINGS

This is an extension to my question https://serverfault.com/a/761474/77231 I am trying to add an additional QUERY STRING parameter to the URL and change spaces to underscores but am having no success. Instead of simply…
TryTryAgain
  • 1,152
  • 5
  • 22
  • 41
2
votes
1 answer

How to parse s3 logs?

I've been trying to parse AWS S3 logs following the documentation, but I've been running into some problems. Specifically, I keep running into new, rare log lines that break my regex. Every time this happens, I modify my regex to account for these…
Talia
  • 201
  • 1
  • 8
2
votes
0 answers

How to modify the message string being logged by syslog?

I have a few linux systems with the keyboard and console shared via a KVM switch. When I switch between them, I get a lot of unwanted syslog messages regarding the keyboard connecting and disconnecting. This is a particular issue for me because I…
Cor
  • 51
  • 3
2
votes
1 answer

Reg Exp for URL in HAProxy

I'm trying to build a reg exp for haproxy that will match the second URL and direct it to a different acl than the first: mysite.com/path/ mysite.com/path/something_random The issue is that my first reg exp matches both urls above when it should…
Nimjox
  • 217
  • 1
  • 3
  • 14
2
votes
1 answer

rabbitmqctl set_policy drops caret (^) anchor from regex pattern

I am running this from PowerShell, so I'm not sure if this would happen in a different environment (the regex itself just includes everything except for those starting with 'amq.'). When I run the following command, the '^' is dropped from the…
Andrew
  • 145
  • 1
  • 1
  • 7
2
votes
0 answers

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 environment where I can go to /401 and be returned a 401…
user300838
  • 121
  • 2
2
votes
2 answers

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: LDAP here Which I would assume would NOT hit /myapp or /myapp/, but it appears that captures…
Stefan Kendall
  • 1,079
  • 3
  • 17
  • 33
2
votes
1 answer

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 process using regex; however, I'm learning that regex…
2
votes
3 answers

Regex Replace Append Filename

How can I append characters to a files name in linux, using a regex? I've seen these two posts https://stackoverflow.com/questions/6985873/change-names-of-multiple-files-linux How to rename multiple files by replacing word in file name? but…
user3783243
  • 99
  • 1
  • 10
2
votes
1 answer

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; fastcgi_pass unix:/var/run/php5-fpm.sock; …
2
votes
0 answers

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 mirrors. I need to recach this directory, for…
vladfau
  • 133
  • 2
  • 7
2
votes
0 answers

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 Messages That Have a Blank Subject, but I tried using…
Eli Ekstein
  • 121
  • 2
2
votes
1 answer

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 documentation on that. Is it uncommon to do this? Seems…
Patrick Savalle
  • 161
  • 2
  • 6