title: Bash Regular Expression -- Can't seem to match any of \s \S \d \D \w \W etc
body: <p>I have a script that is trying to get blocks of information from gparted.</p>
  <p>My Data looks like:</p>
  <pre><code>Disk /dev/sda: 42.9GB
  Sector size (logical/physical): 512B/512B
  Partition Table: msdos
  
  Number  Start   End     Size    Type     File system     Flags
   1      1049kB  316MB   315MB   primary  ext4            boot
   2      316MB   38.7GB  38.4GB  primary  ext4
   3      38.7GB  42.9GB  4228MB  primary  linux-swap(v1)
  
  log4net.xml
  Model: VMware Virtual disk (scsi)
  Disk /dev/sdb: 42.9GB
  Sector size (logical/physical): 512B/512B
  Partition Table: msdos
  
  Number  Start   End     Size    Type     File system     Flags
   1      1049kB  316MB   315MB   primary  ext4            boot
   5      316MB   38.7GB  38.4GB  primary  ext4
   6      38.7GB  42.9GB  4228MB  primary  linux-swap(v1)
  </code></pre>
  <p>I use a regex to break this into two Disk blocks</p>
  <pre><code>^Disk (/dev[\S]+):((?!Disk)[\s\S])*
  </code></pre>
  <p>This works with multiline on.</p>
  <p>When I test this in a bash script, I can't seem to match <code>\s</code>, or <code>\S</code> -- What am I doing wrong?</p>
  <p>I am testing this through a script like:</p>
  <pre><code>data=`cat disks.txt`
  morematches=1
  x=0
  regex=&quot;^Disk (/dev[\S]+):((?!Disk)[\s\S])*&quot;
  
  if [[ $data =~ $regex ]]; then
  echo &quot;Matched&quot;
  while [ $morematches == 1 ]
  do
          x=$[x+1]
          if [[ ${BASH_REMATCH[x]} != &quot;&quot; ]]; then
                  echo $x &quot;matched&quot; ${BASH_REMATCH[x]}
          else
                  echo $x &quot;Did not match&quot;
                  morematches=0;
          fi
  
  done
  
  fi
  </code></pre>
  <p>However, when I walk through testing parts of the regex, Whenever I match a <code>\s</code> or <code>\S</code>, it doesn't work -- what am I doing wrong?</p>