mIRC Home    About    Download    Register    News    Help

Print Thread
script for repeating characters #267681 04/09/20 02:40 AM
Joined: Sep 2020
Posts: 3
G
gabriel_ Offline OP
Self-satisfied door
OP Offline
Self-satisfied door
G
Joined: Sep 2020
Posts: 3
Hi all. smile
I need a code that detects the repeated characters and replace the word with the original without repeating, i.e .:

hooooooowwwwww areeeee yooooou = how are you
hiiiiiiii = hi

I know there would be some problems with some characters like lowercase 'L' and so on but it doesn't matter.

Could someone help me with the code? I can't think of any way to do it.
I'm Sorry for my bad English.
Thank you very much!

Re: script for repeating characters [Re: gabriel_] #267682 05/09/20 08:45 AM
Joined: Aug 2006
Posts: 183
T
Thrull Offline
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2006
Posts: 183
Do you want the script to detect when other use repeating characters or when you do?


Yar
Re: script for repeating characters [Re: Thrull] #267713 08/09/20 02:42 PM
Joined: Sep 2020
Posts: 3
G
gabriel_ Offline OP
Self-satisfied door
OP Offline
Self-satisfied door
G
Joined: Sep 2020
Posts: 3
Hi!
Yes, when other use repeating characters!
Thank you smile

Re: script for repeating characters [Re: gabriel_] #267715 08/09/20 06:05 PM
Joined: Jan 2004
Posts: 1,385
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,385
This matches only when a character if followed by itself at least 2+ extra times, so it does not change the 'll' because there is only 2 of them

//var %pattern /(.)\1{2,}/g | echo -a $regsubex(foo,heeeellooo hooooooowwwwww areeeee yooooou,%pattern,\1)

Re: script for repeating characters [Re: maroon] #267754 17/09/20 02:23 AM
Joined: Sep 2020
Posts: 3
G
gabriel_ Offline OP
Self-satisfied door
OP Offline
Self-satisfied door
G
Joined: Sep 2020
Posts: 3
Thank you very much, it was what I needed! Thank you!! grin grin