Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • Thank you! It works with a[1]. Just for information. I tried a[0] and it showed with the left bracket [ and the right bracket included ]TJ. Why is that? From intuition the achieved match should be stored in a[0]? Commented Sep 21, 2020 at 15:43
  • 2
    @andtoe the most common behavior I've seen across different regex implementations is that 0 has entire match, 1 has first capture portion, 2 has second capture portion and so on Commented Sep 21, 2020 at 15:47
  • Last Question. Can awk be given an option or something else to specify a "mode" of a regular expression standard to be used? Or the other way around: What regular expression standard is used by awk by default? Commented Sep 21, 2020 at 15:47
  • From GNU awk manual: "The regular expressions in awk are a superset of the POSIX specification for Extended Regular Expressions (EREs). POSIX EREs are based on the regular expressions accepted by the traditional egrep utility." Commented Sep 21, 2020 at 15:49
  • @andtoe If you found the answer useful, please consider accepting it so that others facing a similar issue may find it more easily. Commented Sep 21, 2020 at 16:12