Skip to main content
edited body
Source Link
Stéphane Chazelas
  • 584.7k
  • 96
  • 1.1k
  • 1.7k

Interval regexp operators are supported in POSIX compliant awk implementations.

But as awk initially didn't support them (neither did nawk nor mawk nor gawk), there are still several implementations that don't support them like mawk, the one true awk (originally maintained by Brian Kernighan, the k in awk) until a few days ago, Solaris /bin/awk, Solaris /bin/nawk, the awk of most BSDs.

Like for egrep, several implementations objected to adding support for them as they would break backward compatibility (there was no similar problem for \{x,y\} in BREs as used by grep).

\w, \d, \D are perl regexp extensions which are generally not supported (busybox awk and gawk (when not in POSIX mode) support \w). The standard equivalents would be [[:alphaalnum:]_], [[:digit:]], [^[:digit:]] respectively, but are not supported by mawk yet¹.

On Solaris, you'll want to use /usr/xpg4/bin/awk.

With older versions of GNU awk, you had to use the --re-interval option, or start it with POSIXLY_CORRECT=anything in the environment for the regex intervals to be supported.

With implementation that don't support them, you can use combinations of ?, + and *:

  • x{1,3} -> xx?x? or (x|xx|xxx)
  • x{1,} -> x+
  • x{0,} -> x*
  • x{3,} -> xxx+ or xxxx*
  • x{3,6} -> xxxx?x?x?
  • etc.

¹ anyway, mawk doesn't support localisation or multi-byte characters, so you might as well restrict to ASCII characters and use [_a-zA-Z], [0-9] and [^0-9]

Interval regexp operators are supported in POSIX compliant awk implementations.

But as awk initially didn't support them (neither did nawk nor mawk nor gawk), there are still several implementations that don't support them like mawk, the one true awk (originally maintained by Brian Kernighan, the k in awk) until a few days ago, Solaris /bin/awk, Solaris /bin/nawk, the awk of most BSDs.

Like for egrep, several implementations objected to adding support for them as they would break backward compatibility (there was no similar problem for \{x,y\} in BREs as used by grep).

\w, \d, \D are perl regexp extensions which are generally not supported (busybox awk and gawk (when not in POSIX mode) support \w). The standard equivalents would be [[:alpha:]_], [[:digit:]], [^[:digit:]] respectively, but are not supported by mawk yet¹.

On Solaris, you'll want to use /usr/xpg4/bin/awk.

With older versions of GNU awk, you had to use the --re-interval option, or start it with POSIXLY_CORRECT=anything in the environment for the regex intervals to be supported.

With implementation that don't support them, you can use combinations of ?, + and *:

  • x{1,3} -> xx?x? or (x|xx|xxx)
  • x{1,} -> x+
  • x{0,} -> x*
  • x{3,} -> xxx+ or xxxx*
  • x{3,6} -> xxxx?x?x?
  • etc.

¹ anyway, mawk doesn't support localisation or multi-byte characters, so you might as well restrict to ASCII characters and use [_a-zA-Z], [0-9] and [^0-9]

Interval regexp operators are supported in POSIX compliant awk implementations.

But as awk initially didn't support them (neither did nawk nor mawk nor gawk), there are still several implementations that don't support them like mawk, the one true awk (originally maintained by Brian Kernighan, the k in awk) until a few days ago, Solaris /bin/awk, Solaris /bin/nawk, the awk of most BSDs.

Like for egrep, several implementations objected to adding support for them as they would break backward compatibility (there was no similar problem for \{x,y\} in BREs as used by grep).

\w, \d, \D are perl regexp extensions which are generally not supported (busybox awk and gawk (when not in POSIX mode) support \w). The standard equivalents would be [[:alnum:]_], [[:digit:]], [^[:digit:]] respectively, but are not supported by mawk yet¹.

On Solaris, you'll want to use /usr/xpg4/bin/awk.

With older versions of GNU awk, you had to use the --re-interval option, or start it with POSIXLY_CORRECT=anything in the environment for the regex intervals to be supported.

With implementation that don't support them, you can use combinations of ?, + and *:

  • x{1,3} -> xx?x? or (x|xx|xxx)
  • x{1,} -> x+
  • x{0,} -> x*
  • x{3,} -> xxx+ or xxxx*
  • x{3,6} -> xxxx?x?x?
  • etc.

¹ anyway, mawk doesn't support localisation or multi-byte characters, so you might as well restrict to ASCII characters and use [_a-zA-Z], [0-9] and [^0-9]

added 7 characters in body
Source Link
Stéphane Chazelas
  • 584.7k
  • 96
  • 1.1k
  • 1.7k

Interval regexp operators are supported in POSIX compliant awk implementations.

But as awk initially didn't support them (neither did nawk nor mawk nor gawk), there are still several implementations that don't support them like mawk, the one true awk (originally maintained by Brian Kernighan, the k in awk) until a few days ago, Solaris /bin/awk, Solaris /bin/nawk, the awk of most BSDs.

Like for egrep, several implementations objected to adding support for them as they would break backward compatibility (there was no similar problem for \{x,y\} in BREs as used by grep).

\w, \d, \D are perl regexp extensions which are generally not supported (busybox awk and gawk (when not in POSIX mode) support \w). The standard equivalents would be [[:alpha:]_], [[:digit:]], [^[:digit:]] respectively, but are not supported by mawk yet¹.

On Solaris, you'll want to use /usr/xpg4/bin/awk.

With older versions of GNU awk, you had to use the --re-interval option, or start it with POSIXLY_CORRECT=anything in the environment for the regex intervals to be supported.

With implementation that don't support x{1,3}them, you can douse combinations of xx?x? or, (x|xx|xxx)+ and *:

  • x{1,3} -> xx?x? or (x|xx|xxx)
  • x{1,} -> x+
  • x{0,} -> x*
  • x{3,} -> xxx+ or xxxx*
  • x{3,6} -> xxxx?x?x?
  • etc.

¹ anyway, mawk doesn't support localisation or multi-byte characters, so you might as well restrict to ASCII characters and use [_a-zA-Z], [0-9] and [^0-9]

Interval operators are supported in POSIX compliant awk implementations.

But as awk initially didn't support them (neither did nawk nor mawk nor gawk), there are still several implementations that don't support them like mawk, the one true awk (originally maintained by Brian Kernighan, the k in awk) until a few days ago, Solaris /bin/awk, Solaris /bin/nawk, the awk of most BSDs.

Like for egrep, several implementations objected to adding support for them as they would break backward compatibility (there was no similar problem for \{x,y\} in BREs as used by grep).

\w, \d, \D are perl regexp extensions which are generally not supported (busybox awk and gawk (when not in POSIX mode) support \w). The standard equivalents would be [[:alpha:]_], [[:digit:]], [^[:digit:]] respectively, but are not supported by mawk yet¹.

On Solaris, you'll want to use /usr/xpg4/bin/awk.

With older versions of GNU awk, you had to use the --re-interval option, or start it with POSIXLY_CORRECT=anything in the environment for the regex intervals to be supported.

With implementation that don't support x{1,3}, you can do xx?x? or (x|xx|xxx)


¹ anyway, mawk doesn't support localisation or multi-byte characters, so you might as well restrict to ASCII characters and use [_a-zA-Z], [0-9] and [^0-9]

Interval regexp operators are supported in POSIX compliant awk implementations.

But as awk initially didn't support them (neither did nawk nor mawk nor gawk), there are still several implementations that don't support them like mawk, the one true awk (originally maintained by Brian Kernighan, the k in awk) until a few days ago, Solaris /bin/awk, Solaris /bin/nawk, the awk of most BSDs.

Like for egrep, several implementations objected to adding support for them as they would break backward compatibility (there was no similar problem for \{x,y\} in BREs as used by grep).

\w, \d, \D are perl regexp extensions which are generally not supported (busybox awk and gawk (when not in POSIX mode) support \w). The standard equivalents would be [[:alpha:]_], [[:digit:]], [^[:digit:]] respectively, but are not supported by mawk yet¹.

On Solaris, you'll want to use /usr/xpg4/bin/awk.

With older versions of GNU awk, you had to use the --re-interval option, or start it with POSIXLY_CORRECT=anything in the environment for the regex intervals to be supported.

With implementation that don't support them, you can use combinations of ?, + and *:

  • x{1,3} -> xx?x? or (x|xx|xxx)
  • x{1,} -> x+
  • x{0,} -> x*
  • x{3,} -> xxx+ or xxxx*
  • x{3,6} -> xxxx?x?x?
  • etc.

¹ anyway, mawk doesn't support localisation or multi-byte characters, so you might as well restrict to ASCII characters and use [_a-zA-Z], [0-9] and [^0-9]

added 24 characters in body
Source Link
Stéphane Chazelas
  • 584.7k
  • 96
  • 1.1k
  • 1.7k

Interval operators are supported in POSIX compliant awk implementations.

But as awk initially didn't support them (neither did nawk nor mawk nor gawk), there are still several implementations that don't support them like mawkmawk, the one true awk (originally maintained by Brian Kernighan, the k in awk) until a few days ago, Solaris /bin/awk, Solaris /bin/nawk, the awk of most BSDs.

Like for egrep, several implementations objected to adding support for them as they would break backward compatibility (there was no similar problem for \{x,y\} in BREs as used by grep).

\w, \d, \D are perl regexp extensions which are generally not supported (busybox awk and gawk (when not in POSIX mode) support \w). The standard equivalents would be [[:alpha:]_], [[:digit:]], [^[:digit]]digit:]] respectively, but are not supported by mawk yetyet¹.

On Solaris, you'll want to use /usr/xpg4/bin/awk.

With older versions of GNU awk, you had to use the --re-interval option, or start it with POSIXLY_CORRECT=anything in the environment for the regex intervals to be supported.

With implementation that don't support x{1,3}, you can do xx?x? or (x|xx|xxx)


¹ anyway, mawk doesn't support localisation or multi-byte characters, so you might as well restrict to ASCII characters and use [_a-zA-Z], [0-9] and [^0-9]

Interval operators are supported in POSIX compliant awk implementations.

But as awk initially didn't support them (neither did nawk nor mawk nor gawk), there are still several implementations that don't support them like mawk, the one true awk (originally maintained by Brian Kernighan, the k in awk) until a few days ago, Solaris /bin/awk, Solaris /bin/nawk, the awk of most BSDs.

Like for egrep, several implementations objected to adding support for them as they would break backward compatibility (there was no similar problem for \{x,y\} in BREs as used by grep).

\w, \d, \D are perl regexp extensions which are generally not supported (busybox awk and gawk support \w). The standard equivalents would be [[:alpha:]_], [[:digit:]], [^[:digit]] respectively, but are not supported by mawk yet.

On Solaris, you'll want to use /usr/xpg4/bin/awk.

With older versions of GNU awk, you had to use the --re-interval option, or start it with POSIXLY_CORRECT=anything in the environment for the regex intervals to be supported.

With implementation that don't support x{1,3}, you can do xx?x? or (x|xx|xxx)

Interval operators are supported in POSIX compliant awk implementations.

But as awk initially didn't support them (neither did nawk nor mawk nor gawk), there are still several implementations that don't support them like mawk, the one true awk (originally maintained by Brian Kernighan, the k in awk) until a few days ago, Solaris /bin/awk, Solaris /bin/nawk, the awk of most BSDs.

Like for egrep, several implementations objected to adding support for them as they would break backward compatibility (there was no similar problem for \{x,y\} in BREs as used by grep).

\w, \d, \D are perl regexp extensions which are generally not supported (busybox awk and gawk (when not in POSIX mode) support \w). The standard equivalents would be [[:alpha:]_], [[:digit:]], [^[:digit:]] respectively, but are not supported by mawk yet¹.

On Solaris, you'll want to use /usr/xpg4/bin/awk.

With older versions of GNU awk, you had to use the --re-interval option, or start it with POSIXLY_CORRECT=anything in the environment for the regex intervals to be supported.

With implementation that don't support x{1,3}, you can do xx?x? or (x|xx|xxx)


¹ anyway, mawk doesn't support localisation or multi-byte characters, so you might as well restrict to ASCII characters and use [_a-zA-Z], [0-9] and [^0-9]

added 24 characters in body
Source Link
Stéphane Chazelas
  • 584.7k
  • 96
  • 1.1k
  • 1.7k
Loading
Source Link
Stéphane Chazelas
  • 584.7k
  • 96
  • 1.1k
  • 1.7k
Loading