>>>>Lets divide the pattern in 6 groups:
>>>>Group 1: [0-9]+;
>>>>Any quantity of numbers followed by ; and a space
>>>>Group 2: [0-9]+
>>>>Any quantity of numbers followed by a space
>>>>Group 3: [0-9]+
>>>>Any quantity of numbers followed by a space
>>>>Group 4: SCHEMA -
>>>>Exactly the text SCHEMA -
>>>>Group 5: here's the problem...
>>>>Anything unless exactly the text information-schema or anything that doesn't start with pg_
>>>>Group 6: [a-zA-Z]+
>>>>Any quantity of characters.
>>>
>>>
>>>>Lets divide the pattern in 6 groups:
>>>>Group 1: [0-9]+;
>>>>Any quantity of numbers followed by ; and a space
>>>>Group 2: [0-9]+
>>>>Any quantity of numbers followed by a space
>>>>Group 3: [0-9]+
>>>>Any quantity of numbers followed by a space
>>>>Group 4: SCHEMA -
>>>>Exactly the text SCHEMA -
>>>>Group 5: here's the problem...
>>>>Anything unless exactly the text information-schema or anything that doesn't start with pg_
>>>>Group 6: [a-zA-Z]+
>>>>Any quantity of characters.
>>>
>>>For readability, I have
>>>- used [ ] to represent the space char
>>>- put the different groups within parentheses
>>>- used p5 for group 5
>>>
>>>
>>> local regexObj
>>> regexObj = createobject('VBScript.RegExp')
>>> regexObj.Global = .f.
>>> regexObj.IgnoreCase = .f.
>>> regexObj.MultiLine = .f.
>>>
>>> local pattern, p5
>>> pattern = '^(\d+;[ ])(\d+[ ])(\d+[ ])(SCHEMA[ ]-[ ])(%%p5%%)([a-zA-Z]+)$'
>>> p5 = '(?!information-schema[ ])(?!pg_)[\w-]+[ ]'
>>> pattern = strtran(m.pattern, '%%p5%%', m.p5)
>>> regexObj.Pattern = m.pattern
>>>
>>> local samples
>>> text to samples noshow pretext 7
>>> 8; 2615 1490850 SCHEMA - e9999 postgres
>>> 8; 2615 1490850 SCHEMA - pg_catalog postgres
>>> 8; 2615 1490850 SCHEMA - pg_temp postgres
>>> 8; 2615 1490850 SCHEMA - information-schema postgres
>>> 8; 2615 1490850 SCHEMA - information-test postgres
>>> 8; 2615 1490850 SCHEMA - information postgres
>>> 8; 2615 1490850 SCHEMA - schema postgres
>>> 8; 2615 1490850 SCHEMA - myinformation-schema postgres
>>> 8; 2615 1490850 SCHEMA - information-schemas postgres
>>> endtext
>>>
>>> local aa[1], naa, i, s
>>> naa = alines(aa, m.samples)
>>>
>>> for i = 1 to m.naa
>>> s = m.aa[m.i]
>>>
>>> ?m.i, m.regexObj.Test(m.s), m.s
>>> endfor
>>>
Ha. I'd forgotten about the VBScript option - Regex is back in the picture ! :-}
>>
>>I'm going to be dealing with strings (about 150 words long, liberally sprinkled with brackets and commas). I need to scan this text looking for mainly words (but occasionally phrases) contained in a lookup table and, when a matching word/phrase is found, replace it with the replacement text in the lookup. We're estimating that the table will have ~200 entries. A word or phrase may appear multiple times in the text. Won't be starting for a few days - got other stuff to finish up - but I may get back to you on a new thread. Thx.
>
>
>Yes, no problem. Post a few examples when the time comes
>
>And I've posted this a couple of times, it's up to date except VbScript now supports positive and negative lookahead as well - but that can be found towards the end (.Net page 23)
>
>
http://www.atoutfox.org/modules/articles/pdf/0000000748.pdfThx. Must admit I'm not looking forward to this :-{