Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RegEx
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
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:
01555501
Vues:
87
Hi everybody,

I've figured out the first part:
lcString = 'abc1234567890123456fd'

loRegExp = CREATEOBJECT("VBScript.Regexp")
 
loRegExp.PATTERN = "\D\d{16}\D*" && search for non digit following by 16 digits
 
loRegExp.IgnoreCase = .T.
 
loRegExp.GLOBAL = .T.
 
loMatches = loRegExp.Execute(lcString)
 
lnMatches = loMatches.Count   && Number of matches
 
FOR lnMatch = 0 TO (lnMatches - 1)
 
      ?loMatches.Item(lnMatch).FirstIndex && Start position
      ?loMatches.Item(lnMatch).value
 
ENDFOR 
I am looking for a way to identify a 16 digit number preceeding by any non-digit character and ending with non-digit character or nothing. The pattern I defined seems to work. However, I need to replace only that 16 digit number with the 16X. I am not sure how to apply Replace command here.

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform