Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RegEx
Message
De
23/10/2012 11:12:06
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Re: RegEx
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01555501
Message ID:
01555548
Vues:
40
>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
>>&& 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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform