Questions tagged [pattern-matching]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
193 views

Nginx reverse-proxy pass front-end application matching url from HTTPS to HTTP

I everyone. I'm very new to Nginx. My situation is like this. I have a Php application which that handles both backend and front-end, and also I have another ReactJs application as a micro-frontend ...
user avatar
0 votes
1 answer
48 views

Finding a string and remove all contents between two delimiters

I have searched and I don't know what I'm doing wrong but I can't find an answer to this question. I have a file with all text stored as a single line. I am needing to find a pattern and remove all ...
user avatar
0 votes
1 answer
521 views

Nginx pattern matching to part of path

Here's what I would like to accomplish: All requests to /api/... should be directed to a reverse proxy All requests to /static/... should be served from /html/static/pub All other requests should be ...
user avatar
0 votes
0 answers
26 views

Apache RewriteRule, transfer string match into query string parameter

Our website has been redeveloped, and I have been asked to ensure that the previous form of certain URIs are redirected to the new form, so that existing links, bookmarks, etc, don't break. The ...
user avatar
  • 101
0 votes
0 answers
346 views

Nginx location block with regex won't match URL

This is my server block. server { set $auth_header 'Bearer my_token'; listen 80; server_name my.domain.com; location ~ "(/d\-solo/[a-zA-Z]{8,10}/.+\?.+)" { ...
user avatar
  • 245
0 votes
2 answers
78 views

Count instances of a pattern's match in a real-time log file, in a specific time frame, using PowerShell?

I've to intercept a pattern in a log file and, when this pattern is matched for 5 times in 5 minutes, send an alert... I've wrote this lines, but I'm stuck... I don't know how to handle the time ...
user avatar
1 vote
2 answers
8k views

Nginx location match multiple extensions unless path starts with specific word

How can I write a location block that matches any path ending in the following extensions: jpg|jpeg|gif|css|png|js|ico|json|xml|txt|html Unless the path starts with "/rails" (eg: /rails/randomstring/...
user avatar
0 votes
2 answers
1k views

In Nginx config, how to limit regex matching?

In the nginx config file for my server, I have written the following location block: location ~ /page/(?!(3/?|5/?|6/?|8/?)) { return 301 https://anothersite.com/page$is_args$args; } With this, I'...
user avatar
0 votes
1 answer
752 views

How can I match requests for known mime types containing query strings, in nginx?

I'm using nginx to serve assets statically, and also route all non-asset requests to a PHP front controller. I have a location block that looks like: location / { include /etc/nginx/mime.types; ...
user avatar
  • 361
0 votes
1 answer
664 views

Nginx How to set location static files to match with jsessionid

I'm working on Nginx to add cache headers on my static files and works. I'm using this location location ~* \.(ico|css|js|gif|jpeg|jpg|png|woff|ttf|otf|svg|woff2|eot)$ { expires 30d; ...
user avatar
0 votes
1 answer
36 views

Return result only if multiple strings exist in a file

Is there a Linux utility which will return the name of a file only if it contains multiple specified strings? Not necessarily on the same line. Obviously grep can "OR" but I'm looking for "AND".
user avatar
0 votes
2 answers
1k views

syslog-ng prepending date to received logs, breaking patterns in patterndb

I'm setting up central logging for our servers using syslog-ng + patterndb, however the logs the logging server is receiving from the client are prepended with the date, host and other data. This of ...
user avatar
  • 148
-6 votes
1 answer
71 views

Using pattern matching to reduce IP Spoofing [duplicate]

The IP Spoofing is becoming a major concern these days.I was wondering whether we could use pattern matching,like comparing the hop count of the packets coming or the TTL(Time To Live) field of the IP ...
user avatar
0 votes
1 answer
691 views

Lighttpd, regex in conf, path including regex match

The background : - Lighttpd 1.4.28 - Debian 6.0.7 i686 Several developers are using this web server, and each of them has his own virtual host named after "username.mysite.tld". These hosts are ...
user avatar
  • 205
1 vote
1 answer
14k views

RewriteCond not matching on my IP when matching on %{REMOTE_ADDR} [duplicate]

I want a mod_rewrite rule not to be executed when traffic is hitting the web-server from internal network. The web server is an apache 2.2 The following RewriteCond is meant to guard the rewrite rule. ...
user avatar
  • 163
3 votes
1 answer
1k views

htaccess email regex

I am trying to write a patter in such a way that this link : http://www.mysite.com/link/go/emailadress@gmail.com is interpreted like this : http://www.mysite.com/process.php?email=emailadress@gmail....
user avatar
  • 131
2 votes
2 answers
192 views

Display nth instance of grepped pattern

So here's my problem. I have an issue with a .csv file (Current.csv) in that there are commas randomly place throughout the data, so awk-ing the file doesn't give me constant column numbers for a ...
user avatar
0 votes
1 answer
2k views

match 2 numbers in extensions at asterisks dialplan

is there a simple way to match something like this: exten => _+380XXXXXXXXX,1,NoOp(hint that) exten => _0XXXXXXXXX,1,NoOp(hint that) this two extensions matches same number with or without +38 ...
user avatar
  • 1,517
2 votes
2 answers
2k views

How to find .h,.c and .cc files under current directory in linux?

find . -name "*.[hc]|*.cc" The above doesn't work,why? UPDATE How do I find these 3 kinds of files with a single pattern?
user avatar
  • 8,111
1 vote
2 answers
1k views

finding a group of string common in two files

I have used diff command in past.I faced a situation to which I did not had a clue here are some text strings (which can be stored in a file) CONFIG_XEN=y CONFIG_XEN_PVHVM=y ...
user avatar
2 votes
3 answers
3k views

How to delete everything except .svn directories?

I have quite complex directory tree. There are many subdirectories, in those subdirectories beside other files and directories are ".svn" directories. Now, under linux I want to delete all files and ...
user avatar
  • 145
3 votes
1 answer
2k views

makefile shell pattern expansion: how to?

I have found an interesting "feature" of make DIR_INPUT=/test test: # testing date (it should be yesterday) test ! -z "${DATE}" ls -lad ${DIR_INPUT}/{a,c} but it seems to ...
user avatar
  • 2,020
1 vote
4 answers
2k views

How to do a text match in bash

I'm trying to find a nice way of checking some text in order to set a variable. For instance to perform the logic: 'if the version string is 1.x then set a flag'. One way of doing this is: ...
user avatar
4 votes
4 answers
2k views

How can I specify a shell pattern that excludes certain files?

For instance, I want to remove all the files in a directory except for the .tar file from whence they came. I could do something like: find . -maxdepth 0 | grep -v '.tar$' | xargs rm -f but is there ...
user avatar