There's an edge case inherent to tabs this one-liner misses: tabs mask previous spaces within their length, so \s\t should become \t, unless tab length was one.
However, if there are no stray spaces hidden beneath the tabs, it should work.
“It’s only work if somebody makes you do it.” • craft code • creative ideas • cutting edge • author • senior front end architect • professional scuba diver • adventures above and below the sea level
Location
Germany
Work
Senior Front End Architect, Full Stack Engineer, Creative Technologist and Scuba Diving Professional
Unfortunately, that's not a one-liner anymore, as you would have to calculate the expected position of the tab even inside the string, so it's a lot more complex. I would advise to merely document this edge case.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
There's an edge case inherent to tabs this one-liner misses: tabs mask previous spaces within their length, so
\s\t
should become\t
, unless tab length was one.However, if there are no stray spaces hidden beneath the tabs, it should work.
Hey Alex,
Thank you, good catch! You want to contribute an optimised version and I update the article?
Cheers!
Unfortunately, that's not a one-liner anymore, as you would have to calculate the expected position of the tab even inside the string, so it's a lot more complex. I would advise to merely document this edge case.