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

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

stam
Posts: 2680
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

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

Post by stam » Sat May 14, 2022 12:51 pm

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/

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9361
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

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

Post by richmond62 » Sat May 14, 2022 12:54 pm

It is a good thing I have a 4 day holiday at the end of next week.

Thank you.

stam
Posts: 2680
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

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

Post by stam » Sat May 14, 2022 1:42 pm

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 ;)

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7227
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

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

Post by jacque » Sat May 14, 2022 5:20 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

stam
Posts: 2680
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

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

Post by stam » Sat May 14, 2022 10:14 pm

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.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”