Score:2

How to match only single . in file name and not two .?

br flag

In regex, I think I want .*\..* -> Match all files with any characters, single dot, all characters.

In unix filenaming pattern matching, is there a way to do this as *.* matches filenames with two . in them. It will match release_4.18.1 file when I only want it to match all the release_4.18 files.

I am using github branch protection name matching so I can't do fancy commands either in bash or anything :(

Romeo Ninov avatar
in flag
"all characters" include also dot `.`. So you should change the requirements
Score:3
br flag

Something like this perhaps

^[^.]*\.[^.]*$
  • Here we match any number of non-dot characters via [^.]* then a single dot, then any number of non-dot characters again.

  • As a dot in regex means match any character we escape it to match a literal dot.

  • The ^ and $ are start and end of string markers so we don't match more than one thing.

Romeo Ninov avatar
in flag
This match also filenames with more than one dot!
br flag
[not any more](https://regex101.com/r/OILtDV/1)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.