Questions tagged [regular-expressions]

107 questions
3
votes
1 answer

How can I add values to structured data with rsyslog?

Our logs are sent from our applications to rsyslog running on the same host. Rsyslog then forwards the messages to Sumo Logic. We need to add some metadata to our log messages in the structured data field. Some of our applications already use…
Jeff Strunk
  • 2,107
  • 1
  • 24
  • 29
3
votes
1 answer

Adding Curly Braces to Map block in nginx

I am having a problem trying to get the following configuration to work. Every time I run the config test I get a failed pass. To start off let me show you a working configuration location / { if ($query_string ~…
WilhelmE
  • 133
  • 3
3
votes
2 answers

Case insensitive exiqgrep?

My mail queue is currently full of bounce messages for the same domain, but in mixed case. I tried using exiqgrep to filter these mails from my queue, but it seems that the command is case sensitive. Is there any way to perform a case insensitive…
Aron Rotteveel
  • 8,239
  • 17
  • 51
  • 64
3
votes
1 answer

rsync certain files, excluding the rest, ignoring .svn/ directory, recursively

I'm using rsync to copy some files from a share to another. Recursively, I need to: Delete files at destination that were removed from the origin Only sync php and js files Exclude every other file type Do not delete .svn/ directories at…
canolucas
  • 141
  • 1
  • 6
3
votes
1 answer

Powershell deleting files with regular expressions

I have several thousand files of different revisions in a folder. ACZ002-0.p ACZ002-1.p ACZ002-2.p ACZ051-0.p ACZ051-1.p ... The revision is always the last digit before the dot. I need to preserve only the files with the latest revision, but I…
Ales Novy
  • 31
  • 2
3
votes
1 answer

use sed in shell script to replace IP Address in a file

I have a script that finds a string in a file replaces it with a new string. $ sed -i 's/$old_string'/'$new_string'/g' $FILENAME Now I need the condition to be a regular expression that also check whether the old string is followed with anything…
edotan
  • 1,786
  • 12
  • 37
  • 57
3
votes
1 answer

Install yum packages based on regular expression

I would like to install a batch of openoffice.org-* packages from the yum repository. The catch is that I want to exclude the dozens of openoffice.org-langpack* files when I do it. I also don't want to have to run two commands (i.e. yum install…
Scott
  • 397
  • 1
  • 4
  • 14
2
votes
4 answers

cron expression to execute on the "second last working day" of the month

I need your help to contruct a cron job to run the second last working day of every month. I can do LW as shown below but i am not sure how to do second last. I need your help and advise here please. @MWE has kindly provided me a possible solution…
nick
  • 31
  • 1
  • 6
2
votes
1 answer

How to remove mass trailing slashes(Nginx)

I need to remove mass trailing slashes, now I have rewrite ^/(.*)/$ /$1 permanent; So www.example.com/ becomes www.example.com. It's good, but when I go to www.example.com/// (any amount of slashes) it's not redirecting. I need to make any amount…
2
votes
2 answers

Finish processing rewrite directives in location and return 301

I have the following in my nginx.conf: location ~* /collections.*?products/([^/]+)/?$ { rewrite ^/collections.*?products/([^/]+)/?$ /$1.html; rewrite ^([^_]*)_([^_]*)_(.*)$ $1-$2-$3; rewrite ^([^_]*)_(.*)$ $1-$2 permanent; } To…
2
votes
1 answer

Multi-line PCRE w\ lookhead, count matches

I am trying to perform a regex that matches if both the word cat AND dog are in the regex with multi-line support matches cat asdjfaldsfj dog #### does NOT match cat adfasdf8989 #### matches dog adlsjf88989 cat #### matches cat asdf8a89sdf8 a…
SquidZ00
  • 21
  • 2
2
votes
1 answer

postfix virtual map regular expression

I am trying to create a small virtual_alias_maps fiel for postfix-pcre: .*@subdom\.domain\.com test@other.org But I get this error: warning: pcre map /etc/postfix/virtual, line 1: unknown regexp option "c": skipping this rule Where is the error?
user219962
2
votes
3 answers

Regular expression in not working in dnsmasq config

I have dnsmasq version 2.66 installed on CentOS. As per release notes, dnsmasq supports regular expressions starting 2.60 I have following enty in my config file: address=/:clients[0-9]*\.google\.com/192.168.10.2 This single entry should resolve…
Kartik
  • 267
  • 2
  • 9
2
votes
3 answers

RewriteCond RequestURI why RegEx doesn't work?

i have a working RewriteCond like: RequestURL: http://www.myserver.com/images/gallery/summer/2013/2013-07-07/thumbs/001.jpg RewriteCond %{REQUEST_URI} !images/gallery/summer/2013/* RewriteRule ^images/gallery/summer/(.*)$…
chrisK
  • 61
  • 1
  • 1
  • 9
2
votes
1 answer

nginx httpMapModule regex variables

The HttpMapModule documentation states that: Since 1.0.4, case insensitive regular expressions can be used by prefixing the pattern with ~*. And gives the example: map $uri $myvalue { /aa /mapped_aa; ~^/aa/(?.*)$ …
Robin Winslow
  • 209
  • 1
  • 3
  • 11