fork download
  1. #!/bin/bash
  2. # http://stackoverflow.com/questions/30284930/single-pcre-regex-to-swap-0-for-1-and-1-for-0-at-a-specific-location-in/30285133#30285133
  3.  
  4. perl -pe 's/([01])/ 0+!$1 /ge' <<':'
  5. hello111000goodbye
  6. 01010101
  7. 11110000
  8. goodbye
  9. :
  10.  
Success #stdin #stdout 0s 5996KB
stdin
Standard input is empty
stdout
hello000111goodbye
10101010
00001111
goodbye