Please explain the following phenomenon.
(1) Control case (works as expected):
dim s,p as string
dim r as regex
s = "Hello, Matt!"
p = "[a-z]+"
r = new regex
r.searchpattern = p
msgbox r.search(s).subExpressionstring(0)
Result: "Hello". This is what I expect.
(2) Experiment (I don't understand the results here):
dim s,p as string
dim r as regex
s = "Hello, Matt!"
p = "[a-z]+"
s = convertEncoding(s, encodings.macroman)
p = convertEncoding(s, encodings.macroman) // ****
r = new regex
r.searchpattern = p
msgbox r.search(s).subExpressionstring(0)
Result: "Hello, Matt!" Why? It is only the starred line that makes the
difference. I want to do the search using a MacRoman string, so I thought
I had to convert the pattern to MacRoman too (that's what my new
regex-wrapper class does). But I get wrong results if I do that. Why? Thx
- m.
matt neuburg, phd = matt at tidbits dot com, http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
---
A searchable archive of this list is available at:
<http://support.realsoftware.com/listarchives/search.php>
Unsubscribe:
<mailto:realbasic-betas-off at lists dot realsoftware dot com>
Subscribe to the digest:
<mailto:realbasic-betas-digest at lists dot realsoftware dot com>
.
|