Skip to main content
replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
Source Link

Find's -regex matches the entire path, not just the file name. That means that to find /path/to/foo, you need -regex '.*foo', and not just foo`. You want something like:

find  . -E -regex ".*[a-z][A-Z].*"

It would be much simpler to use globs and the simpler -name as suggestedsuggested by SYN, however, instead of regexes.

Find's -regex matches the entire path, not just the file name. That means that to find /path/to/foo, you need -regex '.*foo', and not just foo`. You want something like:

find  . -E -regex ".*[a-z][A-Z].*"

It would be much simpler to use globs and the simpler -name as suggested by SYN, however, instead of regexes.

Find's -regex matches the entire path, not just the file name. That means that to find /path/to/foo, you need -regex '.*foo', and not just foo`. You want something like:

find  . -E -regex ".*[a-z][A-Z].*"

It would be much simpler to use globs and the simpler -name as suggested by SYN, however, instead of regexes.

deleted 170 characters in body
Source Link
terdon
  • 252.2k
  • 69
  • 480
  • 718

There are two issues here. First, find'sFind's -regex matches the entire path, not just the file name. That means that to find /path/to/foo, you need -regex '.*foo', and not just foo`. Second, you can't use capture groups (what would be the point, you can't refer to them anywhere) so the parenthese are taken literally. You want something like:

find  . -E -regex ".*[a-z][A-Z].*"

It would be much simpler to use globs and the simpler -name as suggested by SYN, however, instead of regexes.

There are two issues here. First, find's -regex matches the entire path, not just the file name. That means that to find /path/to/foo, you need -regex '.*foo', and not just foo`. Second, you can't use capture groups (what would be the point, you can't refer to them anywhere) so the parenthese are taken literally. You want something like:

find  . -E -regex ".*[a-z][A-Z].*"

It would be much simpler to use globs and the simpler -name as suggested by SYN, however, instead of regexes.

Find's -regex matches the entire path, not just the file name. That means that to find /path/to/foo, you need -regex '.*foo', and not just foo`. You want something like:

find  . -E -regex ".*[a-z][A-Z].*"

It would be much simpler to use globs and the simpler -name as suggested by SYN, however, instead of regexes.

Source Link
terdon
  • 252.2k
  • 69
  • 480
  • 718

There are two issues here. First, find's -regex matches the entire path, not just the file name. That means that to find /path/to/foo, you need -regex '.*foo', and not just foo`. Second, you can't use capture groups (what would be the point, you can't refer to them anywhere) so the parenthese are taken literally. You want something like:

find  . -E -regex ".*[a-z][A-Z].*"

It would be much simpler to use globs and the simpler -name as suggested by SYN, however, instead of regexes.