All Questions
Tagged with regex or regular-expression 
        
            
                2,839 questions
            
            
            0
            votes
        
        
            1
            answer
        
        
            29
            views
        
    Where can one find a repository of regex for logcheck?
                I was looking at logwatch, but found that it appears to have been replaced by logcheck, and that logcheck is configured by default for just two files using various regexs to match lines in those logs.
...
            
        
       
    
            3
            votes
        
        
            1
            answer
        
        
            167
            views
        
    Syntax Error on ssed for Regex Subroutine definitions
                I'm stuck with this error without clue or reference how to solve it:
I have this list on text.txt
Angie Apple
Angie Banana
Angie Tomato
Angie Peach
Angie Onion
I'm running substitution through ssed (...
            
        
       
    
            5
            votes
        
        
            3
            answers
        
        
            351
            views
        
    Help w/ "posix-extended" regex for 'find'
                Can someone explain the issue I've described below, and perhaps suggest a resolution?
I'm trying to process a set of filenames using find. My platform is macOS (Ventura 13.7.7), and the shell is zsh ...
            
        
       
    
            -1
            votes
        
        
            1
            answer
        
        
            71
            views
        
    sed: why my regex does not work correctly
                So, I'm facing a curious issue with sed; I have reduced my problem down to the following. Why does
sed -e 's/\"\([^\"]*\)\">/\1/' <<< '["\{">'
return ["\{&...
            
        
       
    
            -2
            votes
        
        
            2
            answers
        
        
            108
            views
        
    Perl RegEx one-liner that outputs all matches from one line of STDIN
                Here is a silly example that effectively illustrates what I need:
echo '"this text", " ", "is in speech marks"' | perl -lne 'print "$1" if /"(.*?)"/'
...
            
        
       
    
            2
            votes
        
        
            3
            answers
        
        
            362
            views
        
    sed: invalid usage of line address 0
                I need to keep only last 30 days events in the log and remove other data.
Log has timestamp (date +%e/%b/%Y:%H:%M) and next line values like
01/Jan/2025:00:00
value1
value2
...
01/Jan/2025:06:45
...
            
        
       
    
            3
            votes
        
        
            2
            answers
        
        
            181
            views
        
    Embedded special characters skewing sed output
                The Issue
I've been parsing a file with sed trying to tweeze out the desired data.  This has worked fine for most lines in the file but there appears to be some embedded special characters that are ...
            
        
       
    
            0
            votes
        
        
            5
            answers
        
        
            808
            views
        
    Extract email addresses from line, with multiple email addresses per line
                I have a text file that mixes names and email addresses, in a comma-separated list.
First Person <[email protected]>, Second Person <[email protected]>, Third <[email protected]>
...
            
        
       
    
            -2
            votes
        
        
            1
            answer
        
        
            140
            views
        
    sed inplace in selective block
                I have a dir containing logstash config files
these files have filter blocks, and sometimes nested child blocks
need to match whole filter block
filter { any text till final matching closing brace for ...
            
        
       
    
            3
            votes
        
        
            6
            answers
        
        
            222
            views
        
    regex to find text plus trailing 10+ spaces; sum of two matches' lengths is part of matching condition
                I'm trying to clean files that are copy/pasted versions of my Cygwin (mintty) terminal running bash1. Usually, the input and output are separated by a linefeed ('\n'), as expected. However, when I ...
            
        
       
    
            8
            votes
        
        
            1
            answer
        
        
            599
            views
        
    Is there any way to see the string that was matched in grep?
                I'm not talking about -o option.
Posix says:
The search for a matching sequence starts at the beginning of a string and stops when the first sequence matching the expression is found, where "...
            
        
       
    
            -1
            votes
        
        
            3
            answers
        
        
            104
            views
        
    How to remove markdown links from headers with sed?
                I'm trying to use sed to remove links like and leave just the title:
## [Some title](#some-title)
This is my command:
sed 's/^\(\#*\) *\[\([^\]]*\)\].*/\1 \2/'
I expect to have just the text without ...
            
        
       
    
            0
            votes
        
        
            0
            answers
        
        
            51
            views
        
    Borg files in `~/.local/share/` occur a “dir_open: [Errno 13] Permission denied” error
                General overview
With BorgBackup, I do a backup of my whole $HOME. However, some files (all located on ~/.local/share/) occur a rights error. Probably cause it’s ephemeral  files belonging to root, I ...
            
        
       
    
            1
            vote
        
        
            3
            answers
        
        
            367
            views
        
    How to delete lines with sed if they contain a phrase?
                I tried this
sed -i '/^already satisfied$/d' loggocd.txt
but lines like this one
Requirement already satisfied: cryptography in /home/go/.pyenv/versions/3.9.1/lib/python3.9/site-packages 
are not ...
            
        
       
    
            -3
            votes
        
        
            1
            answer
        
        
            90
            views
        
    How to extract an unknown number of file lines between two regex patterns?
                For example I have file with many of lines and it has such part
...
pattern1
line1
line2
line3
pattern2
...
how can I extract line[1-3] via one-liner command (awk or something like that)?
            
        
       
     
         
         
        