Questions tagged [pattern-matching]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

How can I best construct data structures to retrieve similar values for demographic matching?

The job is person demographic matching/consolidation. I have incoming person demographic information which I need to determine if it is a match against an existing person in the a dataset. I get the ...
Paul Stearns's user avatar
0 votes
1 answer
103 views

iptables: can't drop incoming DNS responses containing a specific IP address

I want to drop incoming DNS responses that contain 10.10.34.35. How can I do that? I tried to it this way: iptables -I INPUT -m udp -p udp --sport 53 -m string --algo kmp --hex-string '|31 30 02 31 30 ...
Masood Lapeh's user avatar
1 vote
0 answers
459 views

Multiple negative lookbehind

I have this code: location ~* (/.*)?(?<!(food/sweet/dessert))/dollaritems { return 301 $1/breakfast/la/dollaritems; } This is working fine to redirect users going to any page with /dollaritems ...
SuperTony's user avatar
0 votes
1 answer
802 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 ...
Dananjaya Ariyasena's user avatar
0 votes
1 answer
335 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 ...
Chris Spangler's user avatar
0 votes
1 answer
4k 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 ...
Máté Safranka's user avatar
0 votes
0 answers
36 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 ...
dave559's user avatar
  • 101
0 votes
0 answers
642 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}/.+\?.+)" { ...
Magnus's user avatar
  • 255
0 votes
2 answers
232 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 ...
ilRobby's user avatar
2 votes
2 answers
12k 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/...
Felipe Zavan's 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'...
vascaino's user avatar
0 votes
1 answer
946 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; ...
alexw's user avatar
  • 371
0 votes
1 answer
842 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; ...
Vinicius Roberto's user avatar
0 votes
1 answer
39 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".
Senior Geek's 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 ...
lsh's user avatar
  • 148
-6 votes
1 answer
73 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 ...
user1369975's user avatar
0 votes
1 answer
861 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 ...
Httqm's user avatar
  • 235
1 vote
1 answer
15k 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. ...
noamik's user avatar
  • 173
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/[email protected] is interpreted like this : http://www.mysite.com/process.php?email=emailadress@gmail....
pollux1er's user avatar
  • 131
2 votes
2 answers
195 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
3k 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 ...
MealstroM's user avatar
  • 1,517
2 votes
2 answers
3k 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?
kernel's user avatar
  • 8,671
1 vote
2 answers
2k 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 ...
Registered User's user avatar
3 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 ...
Arek's user avatar
  • 255
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 ...
asdmin's user avatar
  • 2,060
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: ...
the_mandrill's 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 ...
Jared Oberhaus's user avatar