>>Bigstring = 'cattttccv' >>NonDupeString = NonDupe(BigString) >> >>* Result = 'catv' >>>>
>lcText = REPLICATE('ccaaaaattttttttttvvvv', 102400) >lnStart = SECONDS() >loRegExp = Createobject('VBScript.RegExp') > >with loRegexp as VBScript.RegExp > .IgnoreCase = .t. > .Global = .t. > .Multiline = .T. > .Pattern = '(\w)(\1+)' > lcNewText = .Replace(lcText, '$1') >endwith > >? SECONDS() - lnStart, LEN(lcNewText) >>
lcText = 'abcabcabcaaaaaaa.,aaaaaaaaaaaaaaaa.,' loRegExp = Createobject('VBScript.RegExp') loRegexp.IgnoreCase = .f. loRegexp.Global= .f. loRegexp.Multiline = .f. loRegexp.Pattern = '(.)(.*)(\1)' && any char occurring twice ?lcText do while .t. matches = loRegExp.Execute(m.lcText) if( matches.Count == 0 ) exit endif lcText = strtran(m.lcText, matches.Item[0].SubMatches[0], '', 2) enddo ?lcText