Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [regular-expressions]

The tag has no usage guidance.

-1
votes
0answers
11 views

rsyslogd re_match causes segmentation faults [closed]

When I have a rule if ($msg contains "foobah" OR re_match($msg, '(authmgr|cli)\[[0-9]+\]:') ) then { rsyslog ends up throwing a segmentation fault. Even when I comment out the line containing the ...
0
votes
0answers
33 views

Fail2ban multiline regex - how does it work?

In this example I only want to catch the first part of the second line, but I get a Python error. If I didn't get a Python error, it simply doesn't catch anything at all. The sample goal shows what I'...
0
votes
0answers
27 views

Add rule in .htacces only if domain name begins with <regular-expression>

I have to add a rule in a server that host many sites. This rule must be added only in those .htaccess files that belongs to a site with domain beggining with "dev-" or "review-". I have this: #!/...
2
votes
1answer
47 views

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)...
0
votes
0answers
22 views

Apache LocationMach Regexp doesn't work

I had a simple Location directive that works just fine but attempting to add a second location with regexp make both of them fail (404): Working Location Directive: <Location /test> ...
0
votes
1answer
594 views

postfix smtp_generic_maps with regular expression

I just started playing around with sender address rewriting with postfix. I run a server with debian-7.11 and postfix-2.9.6. Content of /etc/postfix/main.cf: [...] smtp_generic_maps = hash:/etc/...
0
votes
1answer
710 views

Ansible replace. Replace part of the regular expresion

I create a playbook that will harden my linux servers. Part of the process is to replace the umask in the default profiles. So, I have created this task: - name: Change the umask for default profiles ...
1
vote
2answers
456 views

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; ...
1
vote
1answer
225 views

Modify puppet nodes.pp with regex based on network (facter) subnet coverage - needs peer review

For the puppet experts out there, I am trying to modify my node.pp based on the facter network. Example, I would like to have subnets 10.10.10.0 through 10.10.10.255 and 192.168.2.0 network to get the ...
2
votes
1answer
135 views

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 ...
1
vote
2answers
341 views

Regex works everywhere ( tried regex101 and regstorm.net) except Powershell

I have tried various different combos and already checked other similar posts, but can't find my answer. I have a .config file and I need to exclude the comments from the file when I do my search, ...
-1
votes
1answer
90 views

validate file content with bash Regular Expressions + Linux

how to validate the following file content that should be include single integer/float number by bash Regular Expression or any other idea with awk/sed cat /var/VERSION/Version_F35_project_usa 2....
2
votes
2answers
4k views

nginx: multiple matching location blocks

I try to set max-age header directive and Content-Disposition "attachment" as follows: location / { # set up max-age header directive for certain file types for proper caching location ~* \.(...
-3
votes
1answer
171 views

Sed replace path for directory from special file with delimirers slash

i should change on parameter to other from template file in linux. sed -e "s/\${dir}/<in this place i should input path, like /home/username>/" /etc/nginx/site.conf But it does not work. How ...
1
vote
3answers
17k views

Redirect of all the URLs that contain 1 word in specific, but that do not contain other words

I am migrating my website to another platform, but while I finish developing all the pages of the new website, I need my users to navigate between the 2 platforms. So I need to make a 301 redirect of ...
0
votes
3answers
867 views

Logstash Grok Parsing Failed

I need to match this entry 2015/10/30 23:58:21 pid 22223 testuser@testserver.example.com 192.168.0.1 [p4/2012.2/LINUX26X86_64/536738] 'test-monitor show' To match this I wrote this Regex P4_DATE (?...
0
votes
2answers
798 views

Regular expression for second and third domain level with hyphens

I have some smart script, that check name of server and get domain name. For example, i have name of server: example.ru01. I need to get: example.ru My scipt: #!/bin/bash hostname=example.com01 echo ...
0
votes
2answers
595 views

Doesn't work regular expression for domain with hyphens

I have some smart script, that check name of server and get domain name. For example, i have name of server: example.ru01. I need to get: example.ru My scipt: #!/bin/bash hostname=example.com01 echo ...
2
votes
1answer
642 views

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 ...
1
vote
1answer
287 views

Nginx rewrite rule remove subfolders

I'm trying to setup a nginx rewrite rule but can't figure out how to get it working. I want to redirect all urls https://domainname.com/archives/year/month/date/postname to https://domainname.com/...
-1
votes
1answer
546 views

sed + replace value default in grub.conf [closed]

I want to change the default value on all machines to default=0 default value could be any integer number how to set in the sed syntax that default could be any number my example ( not working ) ...
0
votes
1answer
518 views

nginx location regex not working

I'm trying to setup location directive to match my request but can't get it working. Below is my sample request: /APP/public/api/v1/item/100/type location ~* ^/APP/public/api/v1/item/(.*)/type { ...
2
votes
1answer
932 views

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 ...
2
votes
2answers
2k views

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\....
1
vote
1answer
290 views

Exchange 2013 RegEx transport rule

I am looking to create some transport rules for outgoing email based upon AD properties. eg. Phone: 123-456-7890 Where the actual inserted code looks like "Phone: %%PhoneNumber%%", retrieving the ...
1
vote
1answer
929 views

Nginx Config Location Regex With Language Code In Url

Trying to achieve constant language code in url's 1st segment with nginx regex location configuration and could not find the correct syntax. Necessary result: example.com stays example.com example....
0
votes
1answer
568 views

regular expression to match condition of character if exists should always be followed by a pattern

I need a regular expression with the condition that ..if there is an occurrence of character | one time ;the pattern immediately following is ARGS or URL For example abcd ab|ARGS cd|URL etc is ...
0
votes
2answers
2k views

Nginx URI redirect (regular expressions)

I plan to rename one of my site's menu and I'll need to catch the old SEF urls and rewrite them to the new ones. One portion to change is in the middle of URL (old to new) and the other is at the end (...
0
votes
1answer
334 views

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,...
1
vote
1answer
736 views

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 / { ...
1
vote
1answer
438 views

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 ...
0
votes
1answer
449 views

How to escape pipeline char in Windows shell?

I need to specify a regular expression that includes | character to findstr command: processtext.exe | findstr /R "Hello|Bye" How do I escape it? \| does not work. Quotes fix issue with pipelining ...
0
votes
1answer
97 views

Manage several sub domains with nginx

I like to handle different sub domains in my Nginx server, this is my config file (partially) server { listen 80 default_server; listen ...
0
votes
2answers
1k views

How to exclude a certain string in a search pattern

There are several exception messages in catalina.out file of tomcat server just like - java.lang.NullPointerException org.springframework.beans.factory.BeanCreationException java.lang....
1
vote
1answer
836 views

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-...
0
votes
2answers
2k 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
1answer
326 views

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 :( ...
0
votes
2answers
10k 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: [IP_1],[port_1],[ms_time_1];[...
0
votes
2answers
2k views

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 ...
1
vote
0answers
861 views

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[<scenario>].avg(#...
0
votes
1answer
512 views

NGiNX and MediaWiki rewrite regular expression

I am having some problems with regular-expression with rewrite in NGiNX. Here is my config: location /wiki/ { rewrite ^/([^?]*)/([^?]*)(?:\?(.*))? /$1/index.php?title=$2&$3 last; ...
1
vote
0answers
501 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 ...
0
votes
2answers
2k views

nginx dynamic servername with regular expression doesn't work for co.uk

I'm trying to setup a nginx server which dynamically loads content from a folder for a domain. To do this I'm using regular expressions in the server name like so: server_name ((?<subdomain>.+)\...
4
votes
1answer
664 views

nginx - which way is better to redirect and why

I want to redirect from www.mydomain.com to domain.com in nginx. I search the internet and found two ways: First way server { listen 80; server_name www.domain.com; ...
3
votes
2answers
249 views

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. ...
1
vote
1answer
213 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 , then ...
4
votes
1answer
339 views

Apache MatchRedirect exception regex

I want to redirect any URL that is Https and hasn't start with "system_" to the same URL with http. for exapmle for this url : https://exsite.tld/some/thing/that/not/start/with/pattern to : http://...
2
votes
2answers
7k views

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 ^...
0
votes
1answer
359 views

Regular expression to match non-www and non-specified host (nginx)

server { listen 80; server_name ~(?!^www\.)(?!thehost.org); return 301 $scheme://www.$host$request_uri; } I'd like for the server_name to match otherhost.org and ...
0
votes
1answer
1k views

JunOS Regular Expressions for AS Path

I want to write a regex in Juniper MX960 router for BGP including 3 AS paths with first element is constant, second and third are wildcard. I found that we can put as numbers manually like this: "...