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]
730 questions
3
votes
1 answer
Custom logcheck pattern matches using egrep, but logcheck doesn't exclude the relevant lines
We have a custom file for logcheck ignore patterns. Today I decided to add another one but it isn't working as smoothly as I'm used to.
What I normally do is craft a regular expression that will match the line(s) I need to ignore using egrep, and…
ThatGraemeGuy
- 15,588
2
votes
2 answers
Regular Expression for "AND"?
Let's say I gave you the following text:
allow_httpd_anon_write --> off
allow_httpd_mod_auth_ntlm_winbind --> off
allow_httpd_mod_auth_pam --> off
allow_httpd_sys_script_anon_write --> off
httpd_builtin_scripting --> on
httpd_can_check_spam -->…
Soviero
- 4,376
2
votes
1 answer
A regexp for finding enums in Delphi source files?
The background is that I have a complicated memory issue in Delphi. But a theory is that an enum of 5 values can be the root of the bug. So my question to you is:
How do I write a regexpression to search sourcefiles for an enum with 5 values ?
An…
berocoder
- 197
1
vote
2 answers
How can I extract a url from a directory full of garbage using a regexp?
I have thousands of files I downloaded text files of and they all follow the same pattern. The pattern seemed to work in a parser (and notepad++) but when I try to find it on the console and then ultimately want to pipe it to wget for downloading,…
Jonathan
- 151
1
vote
3 answers
Regex for IP after DST= but not after SRC=
I'm searching for a special Regex, that recognizes an IP Adresses after a certain string.
That's the regex for the IP
(([2]([0-4][0-9]|[5][0-5])|[0-1]?[0-9]?[0-9])[.]){3}(([2]([0-4][0-9]|[5][0-5])|[0-1]?[0-9]?[0-9]))
The IP follows in my log to…
user56548
0
votes
1 answer
Simple regex for firewall action logs
just need simple regex I can use to match action from firewall logs. My log looks like this I want to extract just action="whatewer_it_could_be"
repeat-count="0" action="NONE" threat-severity="HIGH"
thank you
/edit I need just regex to put into our…
user1821820
- 33
0
votes
2 answers
grep pattern matching for case insensitivity
I wanted to write a grep function to show me all listening ports on my host.
I know how to do it by using the -i function in grep :
netstat -a |egrep -i 'listen'
But now I wanted to write it in regex :
netstat -a |egrep 'm/listen/i'
I thought :…
Lucas Kauffman
- 16,910
0
votes
1 answer
How to match this URL with PERL REGEX in SQUID?
I am trying to match this URL but Its not working not matching at all ...…
Ghassan
- 1
0
votes
1 answer
Need a regular expression to match 3-member simple series
I need a regex that would match the following example strings:
Example 1: "red, blue, and hot"
Example 2: "red, blue, or hot"
Three individual words, the first two followed by commas, and the conjunction 'and' (case 1) alternatively 'or' (case…