On Tue, Jan 08, 2019 at 10:47:21AM +0000, gilaro wrote: > See also: Does bash support word boundary regular expressions?
Short answer: No. Long answer: Bash's =~ operator uses Extended Regular Expressions (ERE), as implemented by your system's C library's regular expression engine. Your system may or may not offer extensions beyond the standard POSIX definition of ERE. Any such extensions would by definition render your script non-portable, if you write code which relies on them. > I am trying to match on the presence of a word in a list before adding that > word again (to avoid duplicates). I ... Use an associative array instead of an indexed array. Associative arrays give you a natural, efficient way to determine whether an element is present in a set. If you also need to preserve the order of your list, then you may use both an indexed array (to preserve the order) AND an associative array (to check for existence efficiently).