hjr265, (edited )

@adamsdesk I don't think the pattern you pass there can be a regular expression. Bash has its own pattern matching rules.

https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html

I think this does what you are trying to do (replace 2 or more consecutive dashes with a single dash):

string="Hello-World! #debug command---line"  
string="${string//-+(-)/-}"  

But this will work only if you enable extglob first:

shopt -s extglob  

Alternatively, use sed:

string=`echo "$string" | sed -e 's/--\+/-/g'`  
  • All
  • Subscribed
  • Moderated
  • Favorites
  • Bash
  • DreamBathrooms
  • ngwrru68w68
  • modclub
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • InstantRegret
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • mdbf
  • GTA5RPClips
  • JUstTest
  • tacticalgear
  • normalnudes
  • tester
  • osvaldo12
  • everett
  • cubers
  • ethstaker
  • anitta
  • provamag3
  • Leos
  • cisconetworking
  • megavids
  • lostlight
  • All magazines