Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Replace character expression
Message
 
 
To
10/07/2010 00:52:03
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01471799
Message ID:
01472152
Views:
56
>>Try
>>
>>lcStr = "a [1-2] b [2-3] c [3-4] d [4-5] e [5-6] ... [9-10]"
>>
>>loRegEx = NEWOBJECT("VBScript.RegExp")
>>loRegEx.Pattern = "\[([1-9])-([1-9])\]"
>>loRegEx.Global = .T.
>>lcNewStr = loRegEx.Replace(lcStr, "[0$1-0$2]")
>>
>>loRegEx.Pattern = "\[([1-9])-([1-9]\d)\]"
>>lcNewStr = loRegEx.Replace(lcNewStr, "[0$1-$2]")
>>
>>
>>? lcStr
>>? lcNewStr
>
>
>fantastic sergey - many thanks - works perfectly for me. I will spend the next couple of hours trying to figure out exactly what you've done.

You're welcome. Check http://www.regular-expressions.info/ to learn and http://regexlib.com/ for more regular expressions.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform