Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Regular Expressions
Message
De
08/07/2010 05:14:55
 
 
À
08/07/2010 05:07:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01471819
Message ID:
01471822
Vues:
45
HiThomas,

are you sure? I browsed quickly through http://www.regular-expressions.info/vbscript.html, and as I understand it, RegExp will create a collection of matches, which you then can loop through with For Each.


>Hi Ranjan,
>
>regular expressions will only give you .T. or .F. as their only purpose is to verify, if a string contains a given expression or not.
>In your case, you will have to use AT() to find the possible start of searched textblock, then extract five characters (\'d7\) and let them check with regexp. If you receive a .T., then you have a valid block and the first 4 chars can be stored or whatever.
>
>>I'm trying to find all '\xx string in this string:
>>{\rtf1\ansi\ansicpg1252\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\fnil\fprq2\fcharset134 SimSun;}}\viewkind4\uc1\pard\f0\fs14\'d7\'f1\'ca\'d8\'b5\'b1\'b5\'d8\'b7\'a8\'b9\'e6\'b7\'cf\'c6\'fa\'c4\'da\'d7\'b0\'ce\'ef\'ba\'cd\'c8\'dd\'c6\'f7 }.
>>
>>For that I have written the following:
>>
>>test = "{\rtf1\ansi\ansicpg1252\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\fnil\fprq2\fcharset134 SimSun;}}\viewkind4\uc1\pard\f0\fs14\'d7\'f1\'ca\'d8\'b5\'b1\'b5\'d8\'b7\'a8\'b9\'e6\'b7\'cf\'c6\'fa\'c4\'da\'d7\'b0\'ce\'ef\'ba\'cd\'c8\'dd\'c6\'f7 }."
>>
>>Local oRE
>>oRE = CreateObject("VBScript.RegExp")
>>oRE.Pattern = "\\'([a-zA-Z0-9]+)"
>>cresult = oRE.test(test)
>>
>>
>>
>>What I had hoped was that it would have returned only the found bits and pieces. In this case:
>>
>>\'d7\'f1\'ca\'d8\'b5\'b1\'b5\'d8\'b7\'a8\'b9\'e6\'b7\'cf\'c6\'fa\'c4\'da\'d7\'b0\'ce\'ef\'ba\'cd\'c8\'dd\'c6\'f7
>>
>>However, this only returns .T..
>>I used the Regular Expression Tester in Firefox so I know that the pattern is correct....but I seem to miss the point on retrieving the value itself. What am I doing wrong? Any thoughts and help is appreciated.
>>
>>Regards,
>>
>>Ron
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform