Page 2 of 2

Re: How can I replace a random amount of spaces with 1 comma?

Posted: Sat May 14, 2022 12:51 pm
by stam
richmond62 wrote: Sat May 14, 2022 10:34 am So, now might be the appropriate moment to ask Jacque the best place to go to learn regex.
I’ll try and dig up a tutorial site i found a long time ago, but can’t seem to find now. Also rather disconcertingly, Thierry’s site isn’t online - I hope he’s OK.

As a quick reference, I did find this, which seems short and to the point while being fairly clear:
https://docs.rackspace.com/support/how- ... et-basics/

I also use this “playground” for regex to construct the regex - it gives a nicely detailed explanation of each bit of the construct and also includes a handy reference:
https://regex101.com/

Re: How can I replace a random amount of spaces with 1 comma?

Posted: Sat May 14, 2022 12:54 pm
by richmond62
It is a good thing I have a 4 day holiday at the end of next week.

Thank you.

Re: How can I replace a random amount of spaces with 1 comma?

Posted: Sat May 14, 2022 1:42 pm
by stam
There also a ton of videos on YouTube explaining regex for beginners, eg https://youtu.be/kfSptECxFsY

Some minor modifications may be needed to ensure these run as expected in LC but 99% will run as is…

Make your 4-day holiday count ;)

Re: How can I replace a random amount of spaces with 1 comma?

Posted: Sat May 14, 2022 5:20 pm
by jacque
I use https://regex101.com/ too. I tell people I know five words in Linux. I know maybe six words in regex.

Sometimes I use BBEdit too. It can find matches using grep and if it works there it will work in LC. But the website is a better tutorial.

Re: How can I replace a random amount of spaces with 1 comma?

Posted: Sat May 14, 2022 10:14 pm
by stam
FWIW - i found the tutorial i read many moons ago: https://www.regular-expressions.info
It's quite verbose and detailed and you probably only need the starter bits to get you going.