Skip to content

Instantly share code, notes, and snippets.

@hansstimer
Created September 11, 2012 00:55
Show Gist options
  • Save hansstimer/3695166 to your computer and use it in GitHub Desktop.
Save hansstimer/3695166 to your computer and use it in GitHub Desktop.

Revisions

  1. hansstimer created this gist Sep 11, 2012.
    12 changes: 12 additions & 0 deletions iterateregex_example.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    #!/bin/sh
    set -o errexit

    foo="a 1a b c d e"
    bar="a b d e f g"

    for x in $bar
    do
    if ! [[ "$foo" =~ (^|[[:blank:]])$x([[:blank:]]|$) ]]; then
    echo $x
    fi
    done