thank you, this works. but what if i need access to $1, $2, etc.,
outside of the r.replace? i'd like to process the replacement pattern
a bit based on conditions prior to the replacement. this is done with
regexmatch, yes? but that only matches once?
iow, i want to remember if i match a certain thing so i can alert
other code so that i can influence my replacement patterns a bit.
sorry if i'm dense.
-vv
On Feb 25, 2006, at 2:48 AM, Boris Segerstahl wrote:
You don't need to find a search pattern. Try this:
----------------
dim r as new regex
r.options.greedy = true
r.options.replaceallmatches = true
r.options.caseSensitive = true
r.searchpattern = "(sub)?[Ss]ections? (\d{3,4})(\(.+\)){1,6}"
r.replacementPatter = "<a href=""SEC$2.html#$3"">$0</a>"
strinput = r.replace(strinput)
---------------------------
Shout if it does not work.
Boris
On 25 feb 2006, at 05:30, vvor wrote:
regex questions...
the search pattern is supposed to match things like "section 111(a)
(i)" and "section 444" and "subsection 222" and the replacement is
supposed to put tags around the match. i can see that strinput has
about 5-10 of these matches. however, the code is only matching &
replacing once. i'm pretty stumped. when i pass strinput line by
line to this sub, i get multiple matches correctly, so i am pretty
sure the pattern is right. when i concat all the lines into 1
string, it matches once.
please help, regex wizards!
----------------
dim r as new regex
dim cmatch as new regexmatch
r.options.greedy = true
r.options.replaceallmatches = true
r.options.caseSensitive = true
r.searchpattern = "(sub)?[Ss]ections? (\d{3,4})(\(.+\)){1,6}"
cmatch= r.search(strInput)//strinput passed byref
if cmatch <> nil then
strinput = cmatch.replace("<a href=""SEC$2.html#$3"">$0</a>")
end if
-------------------
thanks,
vv
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>