Questions tagged [regular-expressions]

108 questions
1
vote
1 answer

Nginx proxy for CNAME setup

My application serves landing pages and we need users to custom CNAME it eg: {{userdomain}}.myapp.com/{{pageid}} serves the landing pages today. User wants to map it to {{landing}}.theirsite.com So, we allow them to cname it to…
cloudpre
  • 111
  • 2
1
vote
1 answer

How to using sed to change the last character from a match line

How to using sed to change the last character from a match line ? Exemple: /etc/network/interfaces auto eth0 iface eth0 inet static address 150.0.3.50 netmask 255.255.255.0 network 150.0.3.0 gateway 150.0.3.6 auto…
rodolpho
  • 23
  • 4
1
vote
1 answer

htaccess rule for url not ending with certain words

I need to rewrite few urls if those url not ending with certain words. For example, i need to rewrite following url /category1/subcategory1/aproduct-url-title to /category1/fixedword/aproduct-url-title the rewrite should not takes place for the…
codegeek
  • 131
  • 1
  • 2
  • 9
1
vote
1 answer

SetEnvIfNoCase directive match ip failing

I'm trying to set some specific headers based on the client IP address via an Apache reverse proxy. I try to use SetEnvIfNoCase/SetEnvIf but I somehow fail to write a correct regular expression :( Here what I tried to set in httpd.conf (assume that…
vap78
  • 113
  • 3
1
vote
2 answers

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…
Florian
  • 111
  • 1
  • 2
  • 5
1
vote
2 answers

Regular expression for monitoring HTTP errors in apache logs

I'm looking for a regular expression that I can use to scan for HTTP errors in my standard apache log files. I'm interesting in matching all lines that don't have an HTTP 200 or HTTP 204 return status. I can match the lines that do contain either…
ddewaele
  • 333
  • 1
  • 4
  • 12
1
vote
0 answers

How to specify a scenario wildcard in Zabbix expression

I'm using Zabbix 2.0 am wondering how to use a wildcard or regular expression for a scenario name of a trigger? For example, I have the following trigger: MyHost:web.test.fail[].avg(#5)}>0.4 I would like to replace
Jim Geurts
  • 667
  • 2
  • 9
  • 13
1
vote
0 answers

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 https it doesn't. I can't work out why? Can you?
user1573604
  • 145
  • 5
1
vote
1 answer

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 , then copy that email to "others_tlds". (any other =…
1
vote
1 answer

Postfix header checks

How can I write regex for postfix header check to reject all the mails with X-Source-Dir having abc/def? Is this OK? /^X-Source-Dir:\s(.*abc\/def.*)/ REJECT due to spam: Thanks a lot Ladadadada:) But with, /^X-Source-Dir:\s(abc|def)/ REJECT due…
Anaha
  • 11
  • 1
1
vote
1 answer

Regular expressions in GREP

I have an .xml file. The tags inside are: Product Now, I have 20 000 tags like this in the file. One tag however, starts properly but it is missing a proper closing tag. How can I find which line starts properly but does not end with…
Stole
  • 111
  • 1
1
vote
3 answers

Getting different values of particular variable from a file in UNIX

I have a file which I'd like to parse to extract certain values from it. I don't know what command and syntax I should use (maybe sed?). Below are 2 sample lines which I might expect to find in the file. What I need is the value of name (i.e 1234…
dhruv
  • 11
  • 1
1
vote
1 answer

Redirect a url to a different server

I'm looking for a way to redirect any url I visit on my computer (Mac), say www.example1.com/a/b/[\d]+, to another url www.example2.com/a/[\d]+. I don't want this to be on the IP level, just for that particular URL matched by a regular…
1
vote
2 answers

Help with regexp in tag of .htaccess

For poorly configured Apache servers you can have to do something like this to deny access to the .htaccess file: order allow,deny deny from all I would like to deny access to all system files (.* - any file that it's…
Activist
  • 23
  • 1
  • 3
1
vote
2 answers

Need help with grep urgently to comply with subpoena request

I am not a system administrator but I run a little website and today I have received a subpoena request from police, in order to comply I need to extract IP addresses from our server logs for needed time. This is my problem: 1 I have…
Andrey
  • 11
  • 2