[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Silly little regex question



Hi Eric,

 On Sat, 5 Feb 2005 21:47:15 -0500, Eric d'Alibut
<eric.halibut@gmail.com> wrote:
 
 > I guess my question is:
 >
 > "What is a regular expression that would match any number of zeros in
 > succession, and nothing beyond those zeros?"

bash>echo "0000000012345" | sed 's/^0*[0^]//'
bash>12345

  to explain:
      's/                   -substitute
        ^0*              -every '0's in the start of the string
               [0^]      -up to find the first non-zero character
                       //'   -for nothing

 Best Regards,
Lives the Free Software 

Rodrigo Ferreira Baroni



Reply to: