regex - How can I repeat a Perl Regular Expression until no changes are left? -


I'm trying to write a simple command line script to fix some white space and with two tabs Location events need to be changed, but only if it appears at the beginning of the line (prefix only by other tabs).

I s / ^ (\ t *) / / 1 \ t / g; If I run through several passes, then it works perfectly, but I do not have enough information about Pearl, unless there is a change in the string, or if it is a regular Expression is

My only thought was that he had to use a perspective, but this variable may not be length. I want to be open for a non-reggae solution if at least one quick command line is fit in the script.

For reference, the existing Perl script is being implemented in this way:

  perl -pe 's / ^ (\ t *) / $ 1 \ t / G> '   

check

until there is no change By that time, you can use 1 to repeat the pattern while s / ^ (\ t *) / $ 1 \ t / g; left to create

Comments