When asking regex questions, always add the tag for the specific programming language or tool (e.g., Perl, Python, or Java; vi, emacs, or ɢɴᴜ grep; etc.) you are using.
Questions tagged [regex]
720 questions
-1
votes
2 answers
Regex - match third number before a character
I have this string:
/dev/sda1 23G 46G 47G 22%
And want to match only the integer in 47's place.
I tried modifying the "match second set of numbers" example (i.e.,\d+[^\d*](\d+)) here to make it match the third set (e.g., ,…

blashmet
- 19
- 2
-1
votes
1 answer
Some regex for powershell
I have below sample file(s).
Symmetrix logical device count=13
CLARiiON logical device count=0
Invista logical device count=0
Generic logical device count=0
==============================================================================
----- Host…

Eosfor
- 25
- 4
-1
votes
3 answers
perl remove two slashes regex
I have file wich has many lines inside
All lines that contain
file=/aaaaaaa/bbbbbbb/cccccc/dddddd.txt
it needs to be stripped to this format
file=/dddddd.txt
i am executing perl in bash somethin like this
perl -i -pe 'regex'…

Kamil
- 1
-1
votes
3 answers
-1
votes
2 answers
Regular expressions to find SQL Errors in Logs
I am running a log parser to find SQL errors in my log files. If the search string (regular expression) is evaluated to true, the line will be marked. So far I used the search expression "SQL0", which was given to me by our DBAs. However, I recently…

Peter Schuetze
- 1,241
- 10
- 17
-1
votes
1 answer
what the meaning of "logpath = %(nginx_error_log)s" in fail2ban jail log path?
I am running fail2ban on Ubuntu 20.04 server, and am looking over some of the default jails. In [nginx-http-auth] the default log path shows as logpath = %(nginx_error_log)s. What exactly does %(nginx_error_log)s mean in fail2ban, and how does it…

DanRan
- 73
- 1
- 3
- 22
-1
votes
1 answer
Nginx regex for a specific location
I have a proxy_pass for a backend, but in this context, I should serve some static files that are stored in a directory. I`ve tried this:
server {
listen 8180;
location ~ ^/Backend?.(gif|jpg|png|jpeg|pdf|xls|xlsx)$ {
root…
-1
votes
3 answers
Parsing string via regex
How to parse the string output
5 Secs ( 2.2889%) 60 Secs ( 2.5874%) 300 Secs ( 2.6215%)
to take only 2.6215

DenisAnanev
- 47
- 2
-2
votes
1 answer
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}//" /etc/nginx/site.conf
But it does not work. How to resolve it ? May be there are other ways, how to…

Piduna
- 1
- 3
-2
votes
1 answer
regex excluding lines with x number of \'s
I am sure this has been asked and solved before but I am stuck on this simple regex expression. I am using powershell and .net for the regex.
Let's say I have a file which contains these lines:
C:\share\my…

Nate Stone
- 49
- 1
- 3
-2
votes
1 answer
Regex to Match To: Header with More than One Email Address
I know that there seems to be no perfect regex to match even one email address, but I'm trying to catch outgoing emails that are sent with multiple TO: header recipients, and the only option I have is to apply a regex to match the text of the full…

iopener
- 187
- 12
-2
votes
2 answers
how to replace one url with another using sed inplace replace in multiple files?
As you can see in the script example down there, I'm trying to find and replace (inplace replace) a string which is part of an URL with another string (url part) within ALL files found with that pattern of URL.
In other words, all *.txt files which…

Axel Werner
- 156
- 1
- 12
-2
votes
1 answer
Regex help for .htaccess
I want to exclude access to certain files using .htaccess files but i need help generating the correct regexp.
I want to exclude access to these two files:
soft1-pp_1.12-123456789010_amd64.deb
soft1-tt_1.12-123456789010_amd64.deb
Version numbers…

user178250
- 103
- 1
-2
votes
2 answers
NTP server hostname validation regex
I want make basic syntax validation of NTP server hostnames. (For example, I expect %^$&" is a syntaxticly invalid NTP server hostname.)
The reason I want to make this basic validation is because I am building a Web app to configure a server. The…

Randomblue
- 1,165
- 5
- 16
- 33
-3
votes
1 answer
Apache FilesMatch directive - "Multiple arguments not (yet) supported"
What the heck... There's only one argument, the regex.
Earlier in the file, I denied all.
Now I just want to allow access to index.php, as well as images, css, and javascript.
…

Buttle Butkus
- 1,741
- 8
- 33
- 45