>>>Hi Gregory,
>>>
>>>I've run that code, but it doesn't do what I need. I want to replace the numbers with X, e.g. the resulting string should be
>>>'abcXXXXXXXXXXXXXXXXfd'
>>
>>Shouldn't be difficult, use option (2) slightly altered
>>
>So, do I understand correctly it's not easy with replace? E.g. I've tried:
You're mixing things - see my other reply - and read and digest the pages I pointed to
>
>if( m.loRegExp.Test(m.lcString) )
> ? 'old: ', m.lcString
> lcString = m.loRegExp.Replace(m.lcString, '$1X{16}$3')
>
> ? 'new: ', m.lcString
>endif
>
>but that converted the string into X{16}. I guess I can use 16X instead.
>
>>>>&& or with Execute()
>>>>lcString = 'abc1234567890123456'
>>>>
>>>>matchesObj = m.loRegExp.Execute(m.lcString)
>>>>
>>>>? 'old: ', m.lcString
>>>>
>>>>for i = m.matchesObj.Count - 1 to 0 step -1
>>>> match = m.matchesObj.item(m.i)
>>>>
>>>>
>>>>
>>>> ?match.Submatches.Count
>>>> ?match.Submatches[0]
>>>> ?match.Submatches[1]
>>>> ?match.Submatches[2]
>>>>
>>>>&& s = m.match.Submatches[0] + m.match.Submatches[1] + 'X' + match.Submatches[2]
>>
>>
>>
>> s = m.match.Submatches[0] + repl('X', len( m.match.Submatches[1] )) + m.match.Submatches[2]
>>
>>
>>
>>>> lcString = stuff(m.lcString, m.match.FirstIndex+1, m.match.Length, m.s)
>>>>
>>>>
>>>>endfor
>>>>? 'new: ', m.lcString
>>>>
Gregory