Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Replace character expression
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01471799
Message ID:
01472100
Vues:
33
thank you sergey. As naomi mentioned both yours and rob's solution work fine.

if it's not too much of a strain on the imposition, how would i change this formula to catch
lcStr = "a [1-2] b [2-3] c [3-4] d [4-5] e [5-6] ... [9-10]" && in latter case 10 would not be altered

such that [1-2] would be changed to [01-02]
k
lcStr = "a [1] b [2] c [3] d [4] e [5] ... [9]"
loRegEx = NEWOBJECT("VBScript.RegExp")
loRegEx.Pattern = "\[([1-9])\]"
loRegEx.Global = .T.
lcNewStr = loRegEx.Replace(lcStr, "[0$1]")

? lcStr
? lcNewStr
>
>>>Try the following:
>>>
>>>oRegEx = NEWOBJECT("VBScript.RegExp")
>>>oRegEx.Pattern = "\[(\d)\]"
>>>cFile = oRegEx.Replace(cFile, "[0$1]")
>>>
>>
>>thanks rob - no effect i'm afraid but i'm wondering if this is addressing the change i am looking for (I am trying to understand your replace code "[0$1]" and have modified it a couple of times without success.
>>
>>basically the text looks something like this
>>
>>asdfghjkl [1]
>>
>>and i want it to look like this
>>
>>asdfghjkl [01]
>>
>>
>>thanks
>>k
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform