[MacPorts] #45500: ctags @5.8_1: --regex- flags don't work with some regular expressions that work on Linux (was: ctags @5.8_1 ignores --regex- flags)

MacPorts noreply at macports.org
Sun Jul 12 03:09:50 UTC 2026


#45500: ctags @5.8_1: --regex- flags don't work with some regular expressions that
work on Linux
-----------------------+--------------------------------
  Reporter:  mvgrimes  |      Owner:  macports-tickets@…
      Type:  defect    |     Status:  reopened
  Priority:  Normal    |  Milestone:
 Component:  ports     |    Version:  2.3.2
Resolution:            |   Keywords:
      Port:  ctags     |
-----------------------+--------------------------------
Changes (by ryandesign):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Replying to [ticket:45500 mvgrimes]:
 > I wonder if this has to do with the regex library that ctags is compiled
 with?

 I believe that's exactly right. ctags ships with the GNU regex library but
 it doesn't use it if the system already provides a regex library. So on
 Linux, ctags uses the system's GNU regex library, and on macOS, it uses
 the system's BSD regex library.

 The GNU regex library evidently recognizes `\w` to match any word
 character and `\s` to match any whitespace character while the BSD regex
 library does not. This syntax appears to be considered a GNU extension.

 To achieve the same effect using a POSIX-standard regular expression which
 should work with either regex library, use `[[:alnum:]_]` to match any
 word character and `[[:space:]]` to match any whitespace character:

 {{{
 ctags --options=NONE --regex-
 javascript='/([[:alnum:]_]+)[[:space:]]*=[[:space:]]*function/\1/f,function/'
 test.js
 }}}

 The question is whether we consider this a bug. We could consider it a
 natural difference between operating systems, in which case we could close
 this ticket as wontfix. Or we could consider GNU regex extensions to be
 useful and try to get the ctags port to support them by using the GNU
 regex library. Ordinarily it would be preferable to use the existing
 MacPorts gnuregex port however it is from 1993 and does not build
 (#62307). But the GNU regex library bundled with ctags might not build
 either, since it's from 2009.

-- 
Ticket URL: <https://trac.macports.org/ticket/45500#comment:7>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list