Skip to main content

Questions tagged [regular-expression]

Regular expressions are a means of matching a pattern of characters within a string.

8 votes
1 answer
98 views

According to chapter 9. Regular Expressions, subchapter 9.3.6 BREs Matching Multiple Characters, number "3.": "... the expression "\(a\(b\)*\)*\2" fails to match 'abab' ...&...
becke-ch's user avatar
  • 223
7 votes
2 answers
286 views

I'm running a reasonably up-to-date Msys2: $ uname -a; bash -version MSYS_NT-10.0-26100 md2syz7c 3.6.6-2369286a.x86_64 2026-01-14 12:29 UTC x86_64 Msys GNU bash, version 5.3.9(1)-release (x86_64-pc-...
Peter - Reinstate Monica's user avatar
8 votes
5 answers
1k views

I have text with lowercase followed by uppercase, for example: aB (a and B can be any letters) and I would like to change it to: a_b thus changing the uppercase letter of the matched text with _ and ...
xyx's user avatar
  • 897
0 votes
3 answers
124 views

On some linux systems the following command will output a single large string rpm -qa --qf '%{NAME} ' For those who don't have this command it outputs values with the following pattern: a b c d e f g ...
user1801060's user avatar
0 votes
4 answers
193 views

I'm trying to write up a script to interact with the log files of Postgres. I have a query to get the filename of the log files. sudo -u postgres psql -tc "SELECT setting FROM pg_settings WHERE ...
NobleOccum's user avatar
3 votes
3 answers
1k views

The following script is supposed to check $1 and see if it is a specific value. It only works when one Bash [[... =~ ...]] regex check is passed in an if statement. The error is: When more than one ...
EmberNeurosis's user avatar
0 votes
2 answers
105 views

Logical way would be to use an 's/[\[\]]/_/g' regexp replace, however it does not work as intended to. It replaces a chain of [ and ] with a single _. $ echo 'x[]x'|sed -E -e 's/[\[\]]/_/g' x_x $ echo ...
peterh's user avatar
  • 1
0 votes
2 answers
142 views

I'm trying to understand some subtle behavior of find and its -regex option I am trying to create symbolic links from files entitled slides_.*.pdf in folders that start with L1[0-6]. I tried the ...
mikemtnbikes's user avatar
1 vote
1 answer
72 views

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. ...
leeand00's user avatar
  • 4,970
3 votes
2 answers
229 views

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 (...
Zerchro's user avatar
  • 31
6 votes
3 answers
492 views

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 ...
Seamus's user avatar
  • 4,068
-1 votes
1 answer
122 views

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 ["\{&...
Grass's user avatar
  • 145
-1 votes
3 answers
593 views

Here is a silly example that effectively illustrates what I need: echo '"this text", " ", "is in speech marks"' | perl -lne 'print "$1" if /"(.*?)"/' ...
Signor Pizza's user avatar
2 votes
3 answers
448 views

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 ...
Aleksey's user avatar
  • 75
3 votes
2 answers
230 views

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 ...
Gandalf's user avatar
  • 33

15 30 50 per page
1
2 3 4 5
190