134 lines
21 KiB
Plaintext
134 lines
21 KiB
Plaintext
{\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}
|
|
{\f2\fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}{\f23\froman\fcharset128\fprq1{\*\panose 00000000000000000000}MS Mincho{\*\falt MS ??};}{\f28\froman\fcharset128\fprq1{\*\panose 00000000000000000000}@MS Mincho;}
|
|
{\f29\froman\fcharset238\fprq2 Times New Roman CE;}{\f30\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f32\froman\fcharset161\fprq2 Times New Roman Greek;}{\f33\froman\fcharset162\fprq2 Times New Roman Tur;}
|
|
{\f36\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f37\fswiss\fcharset238\fprq2 Arial CE;}{\f38\fswiss\fcharset204\fprq2 Arial Cyr;}{\f40\fswiss\fcharset161\fprq2 Arial Greek;}{\f41\fswiss\fcharset162\fprq2 Arial Tur;}
|
|
{\f44\fswiss\fcharset186\fprq2 Arial Baltic;}{\f45\fmodern\fcharset238\fprq1 Courier New CE;}{\f46\fmodern\fcharset204\fprq1 Courier New Cyr;}{\f48\fmodern\fcharset161\fprq1 Courier New Greek;}{\f49\fmodern\fcharset162\fprq1 Courier New Tur;}
|
|
{\f52\fmodern\fcharset186\fprq1 Courier New Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;
|
|
\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red51\green102\blue255;\red255\green153\blue0;}{\stylesheet{
|
|
\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}{\s3\ql \li0\ri0\sb240\sa60\keepn\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
|
|
\b\f1\fs26\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 heading 3;}{\*\cs10 \additive Default Paragraph Font;}{\s15\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
|
|
\f2\fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext15 Plain Text;}}{\*\listtable{\list\listtemplateid2111475034\listhybrid{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
|
|
{\leveltext\leveltemplateid-1177110348\'02\'00);}{\levelnumbers\'01;}\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li1080\jclisttab\tx1080 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0
|
|
\levelindent0{\leveltext\leveltemplateid67698713\'02\'01.;}{\levelnumbers\'01;}\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1 \fi-360\li1800\jclisttab\tx1800 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace0
|
|
\levelindent0{\leveltext\leveltemplateid67698715\'02\'02.;}{\levelnumbers\'01;}\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1 \fi-180\li2520\jclisttab\tx2520 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0
|
|
\levelindent0{\leveltext\leveltemplateid67698703\'02\'03.;}{\levelnumbers\'01;}\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1 \fi-360\li3240\jclisttab\tx3240 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0
|
|
\levelindent0{\leveltext\leveltemplateid67698713\'02\'04.;}{\levelnumbers\'01;}\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1 \fi-360\li3960\jclisttab\tx3960 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace0
|
|
\levelindent0{\leveltext\leveltemplateid67698715\'02\'05.;}{\levelnumbers\'01;}\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1 \fi-180\li4680\jclisttab\tx4680 }{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0
|
|
\levelindent0{\leveltext\leveltemplateid67698703\'02\'06.;}{\levelnumbers\'01;}\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1 \fi-360\li5400\jclisttab\tx5400 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0
|
|
\levelindent0{\leveltext\leveltemplateid67698713\'02\'07.;}{\levelnumbers\'01;}\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1 \fi-360\li6120\jclisttab\tx6120 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace0
|
|
\levelindent0{\leveltext\leveltemplateid67698715\'02\'08.;}{\levelnumbers\'01;}\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1 \fi-180\li6840\jclisttab\tx6840 }{\listname ;}\listid1770730755}}{\*\listoverridetable{\listoverride\listid1770730755
|
|
\listoverridecount0\ls1}}{\info{\title COXRegular - new class that implements regular expression functionality}{\author DmitriyF}{\operator DmitriyF}{\creatim\yr1999\mo12\dy17\hr12\min26}{\revtim\yr1999\mo12\dy22\hr15\min31}{\version6}{\edmins31}
|
|
{\nofpages3}{\nofwords835}{\nofchars4764}{\*\company Dundas}{\nofcharsws0}{\vern8247}}\margl1319\margr1319 \widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\formshade\horzdoc\dgmargin\dghspace180\dgvspace180
|
|
\dghorigin1319\dgvorigin1440\dghshow1\dgvshow1\jexpand\viewkind4\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule \fet0\sectd
|
|
\linex0\endnhere\sectlinegrid360\sectdefaultcl {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4
|
|
\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}
|
|
{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain
|
|
\s3\qc \li0\ri0\sb240\sa60\keepn\widctlpar\aspalpha\aspnum\faauto\outlinelevel2\adjustright\rin0\lin0\itap0 \b\f1\fs26\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\dbch\af23 \hich\af1\dbch\af23\loch\f1 COXRegExpression
|
|
\par }\pard\plain \s15\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \f2\fs20\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\b\dbch\af23 \hich\af2\dbch\af23\loch\f2 COXRegExpression}{\dbch\af23 \hich\af2\dbch\af23\loch\f2
|
|
- new class that implements regular expression functionality.
|
|
\par
|
|
\par }\pard \s15\qj \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {\dbch\af23 \tab \hich\af2\dbch\af23\loch\f2 Most of us had problems with searching some text in text files. Yes, we can use searching capabilities that are provided with
|
|
\tab many programs. But, in case we have to do some generic search it is not the case. For such cases }{\b\dbch\af23 \hich\af2\dbch\af23\loch\f2 COXRegExpression}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 class is exactly what \hich\af2\dbch\af23\loch\f2
|
|
we had to have. This class provided generic search regarding the rule you've supplied. To do search, you have to load regular expression that defines what do you want to search. There are different formats and different implementation for regular expressi
|
|
\hich\af2\dbch\af23\loch\f2 o\hich\af2\dbch\af23\loch\f2 n. This implementation is most close to that one described in MSDN that comes with Visual Studio 6.0
|
|
\par }\pard \s15\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {\dbch\af23
|
|
\par \tab \hich\af2\dbch\af23\loch\f2 The rules:
|
|
\par
|
|
\par \hich\af2\dbch\af23\loch\f2 Character\tab \tab \tab \tab Description
|
|
\par
|
|
\par \tab \\\tab \tab \hich\af2\dbch\af23\loch\f2 Marks the next character as special. All characters that are
|
|
\par \tab \tab \tab \hich\af2\dbch\af23\loch\f2 special but you want to define it for sear\hich\af2\dbch\af23\loch\f2 ch should be
|
|
\par \tab \tab \tab \hich\af2\dbch\af23\loch\f2 preceding by this character.
|
|
\par \tab \hich\af2\dbch\af23\loch\f2 ^\tab \tab Matches the begining of input or line. In this implementation \tab \tab \tab it cannot be defined in charset.
|
|
\par \tab \hich\af2\dbch\af23\loch\f2 $\tab \tab Matches the end of input or line. In this implementation it
|
|
\par \tab \tab \tab \hich\af2\dbch\af23\loch\f2 cannot be defined in charset.
|
|
\par \tab \hich\af2\dbch\af23\loch\f2 *\tab \tab \hich\af2\dbch\af23\loch\f2 Matches preceding character zero or more times. In this \tab \tab \tab \tab implementation cannot be defined if only one character \tab \tab \tab \tab
|
|
specified in the regular expression. That means that /}{\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 zo*}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 / \tab \tab \tab matches z and zoo, but /}{\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 z*}{\dbch\af23
|
|
\hich\af2\dbch\af23\loch\f2 / will match nothing because only \tab \tab \tab one char\hich\af2\dbch\af23\loch\f2 acter has been specified.
|
|
\par \tab \hich\af2\dbch\af23\loch\f2 +\tab \tab Matches preceding character one or more times.
|
|
\par \tab \hich\af2\dbch\af23\loch\f2 ?\tab \tab Matches preceding character zero or one time. In this \tab \tab \tab \tab implementation cannot be defined if only one character \tab \tab \tab \tab specified in the regular expression.
|
|
\par \tab \hich\af2\dbch\af23\loch\f2 .\tab \tab Matches any\hich\af2\dbch\af23\loch\f2 single character except '\\n'
|
|
\par \hich\af2\dbch\af23\loch\f2 (pattern)\tab \tab Matches pattern and remembers the match. The matched \tab \tab \tab \tab substring can be retrieved by using '\\0'-'\\9' in regular \tab \tab \tab \tab
|
|
expression, where '0'-'9' are number of the pattern. Example:
|
|
\par \tab \tab \tab \hich\af2\dbch\af23\loch\f2 regular expression '}{\cf17\dbch\af23 \hich\af2\dbch\af23\loch\f2 (re).*\\\hich\af2\dbch\af23\loch\f2 0s+ion}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 ' will match }{\b\cf18\dbch\af23 \hich\af2\dbch\af23\loch\f2
|
|
'regular \tab \tab \tab \tab expression}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 ' because first matches pattern '}{\b\cf18\dbch\af23 \hich\af2\dbch\af23\loch\f2 re}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 ' and remember \tab \tab \tab
|
|
the pattern with index 0. '}{\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 .*}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 ' will match '}{\b\cf18\dbch\af23 \hich\af2\dbch\af23\loch\f2 gular exp}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 ' in \tab \tab \tab \tab '
|
|
}{\b\dbch\af23 \hich\af2\dbch\af23\loch\f2 re}{\b\cf18\dbch\af23 \hich\af2\dbch\af23\loch\f2 gular exp}{\b\dbch\af23 \hich\af2\dbch\af23\loch\f2 ression}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 '. Now we retrieve pattern with index 0, \tab \tab \tab
|
|
that has been remembered with in\hich\af2\dbch\af23\loch\f2 dex 0, this is '}{\b\cf18\dbch\af23 \hich\af2\dbch\af23\loch\f2 re}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 ' that \tab \tab \tab \tab matches '}{\b\cf18\dbch\af23 \hich\af2\dbch\af23\loch\f2 re
|
|
}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 ' in '}{\b\dbch\af23 \hich\af2\dbch\af23\loch\f2 regular exp}{\b\cf18\dbch\af23 \hich\af2\dbch\af23\loch\f2 re}{\b\dbch\af23 \hich\af2\dbch\af23\loch\f2 ssion}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 ' before '}{
|
|
\b\cf18\dbch\af23 \hich\af2\dbch\af23\loch\f2 ssion}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 ' and , \tab \tab \tab \tab finally, '}{\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 s+ion}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 ' matches '}{\b\cf18\dbch\af23
|
|
\hich\af2\dbch\af23\loch\f2 ssion}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 '
|
|
\par \tab \hich\af2\dbch\af23\loch\f2 x|y\tab \tab Matches either character 'x' or 'y'. You can combine more \tab \tab \tab \tab than two characters like '}{\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 x|y|z}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 '
|
|
\par \hich\af2\dbch\af23\loch\f2 \{n\}\tab \tab Means precedin\hich\af2\dbch\af23\loch\f2 g character will match exactly n times \tab \tab \tab \tab (nonnegative, of course)
|
|
\par \hich\af2\dbch\af23\loch\f2 \{n,\}\tab \tab Means preseding character will match at least n times \tab \tab \tab \tab (nonnegative)
|
|
\par \hich\af2\dbch\af23\loch\f2 \{n,m\}\tab \tab Means preceding character will match at least n times and at
|
|
\par \tab \tab \tab \hich\af2\dbch\af23\loch\f2 most m times. (n,m - no\hich\af2\dbch\af23\loch\f2 nnegative)
|
|
\par \hich\af2\dbch\af23\loch\f2 [xyz]\tab \tab A character set. Matches any one of enclosed characters
|
|
\par }\pard \s15\ql \fi-2160\li2160\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin2160\itap0 {\dbch\af23 \hich\af2\dbch\af23\loch\f2 [^xyz]\tab A non-matching character set. Matches any character
|
|
\par }\pard \s15\ql \li2160\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin2160\itap0 {\dbch\af23 \hich\af2\dbch\af23\loch\f2 that is not in the set.
|
|
\par }\pard \s15\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {\dbch\af23 \tab \\\hich\af2\dbch\af23\loch\f2 b\tab \tab Matches word boundary, that is boundary between any character
|
|
\par }\pard \s15\ql \fi720\li1440\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin1440\itap0 {\dbch\af23 \hich\af2\dbch\af23\loch\f2 excluding space characters (" \\f\\n\\r\\t\\v") and space
|
|
\par \hich\af2\dbch\af23\loch\f2 characters
|
|
\par }\pard \s15\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {\dbch\af23 \tab \\\hich\af2\dbch\af23\loch\f2 B\tab \tab Matches non-word boundary. Matches any boundary between space
|
|
\par \tab \tab \tab \hich\af2\dbch\af23\loch\f2 characters or between nonspace characters.
|
|
\par \tab \\\hich\af2\dbch\af23\loch\f2 d\tab \tab Matches any digit /0-9/
|
|
\par \tab \\\hich\af2\dbch\af23\loch\f2 D\tab \tab Matches any non-digit.
|
|
\par \tab \\\hich\af2\dbch\af23\loch\f2 f\tab \tab Matches \hich\af2\dbch\af23\loch\f2 a formfeed.
|
|
\par \tab \\\hich\af2\dbch\af23\loch\f2 n\tab \tab Matches a new-line character
|
|
\par \tab \\\hich\af2\dbch\af23\loch\f2 r\tab \tab Matches a carridge return character.
|
|
\par \tab \\\hich\af2\dbch\af23\loch\f2 s\tab \tab Matches any white space character
|
|
\par \tab \\\hich\af2\dbch\af23\loch\f2 S\tab \tab Matches any non-white space character
|
|
\par \tab \\\hich\af2\dbch\af23\loch\f2 t\tab \tab Matches a tab character
|
|
\par \tab \\\hich\af2\dbch\af23\loch\f2 v\tab \tab Matches any vertical tab character
|
|
\par \tab \\\hich\af2\dbch\af23\loch\f2 w\tab \tab Match\hich\af2\dbch\af23\loch\f2 es any word character including underscore. [A-Za-z0-9_]
|
|
\par }\pard \s15\ql \fi-1440\li2160\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin2160\itap0 {\dbch\af23 \\\hich\af2\dbch\af23\loch\f2 W\tab Matches any non-word character (any character that does not
|
|
\par }\pard \s15\ql \li2160\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin2160\itap0 {\dbch\af23 \hich\af2\dbch\af23\loch\f2 match \\w)
|
|
\par }\pard \s15\ql \fi-1440\li2160\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin2160\itap0 {\dbch\af23 \\\hich\af2\dbch\af23\loch\f2 num\tab Where num is number between 0 and 9. Matches
|
|
\par }\pard \s15\ql \li2160\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin2160\itap0 {\dbch\af23 \hich\af2\dbch\af23\loch\f2 remembered pattern. (See description of pattern)
|
|
\par }\pard \s15\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {\dbch\af23 \tab \hich\af2\dbch\af23\loch\f2 /n/\tab \tab Where n is bet\hich\af2\dbch\af23\loch\f2 ween 1 and 255. Matches supplied in n ASCII
|
|
\par }\pard \s15\ql \fi720\li1440\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin1440\itap0 {\dbch\af23 \hich\af2\dbch\af23\loch\f2 code
|
|
\par }\pard \s15\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {\dbch\af23
|
|
\par
|
|
\par \hich\af2\dbch\af23\loch\f2 Three easy steps to use:
|
|
\par {\listtext\pard\plain\s15 \fs20\loch\af2\hich\af2\dbch\af23 \hich\af2\dbch\af23\loch\f2 1)\tab}}\pard \s15\ql \fi-360\li1080\ri0\widctlpar\jclisttab\tx1080\aspalpha\aspnum\faauto\ls1\adjustright\rin0\lin1080\itap0 {\dbch\af23 \hich\af2\dbch\af23\loch\f2
|
|
Create your own derived from }{\b\dbch\af23 \hich\af2\dbch\af23\loch\f2 COXRegExpression}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 class and override function
|
|
\par }\pard \s15\ql \fi360\li720\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin720\itap0 {\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 OnMatch()}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 This virtual function is always called when a matched
|
|
\par \hich\af2\dbch\af23\loch\f2 substring has been found. When this function is called you can return
|
|
\par \hich\af2\dbch\af23\loch\f2 TRUE to continue search or FALSE if you do not want continue search.
|
|
\par }\pard \s15\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {\dbch\af23 \tab \hich\af2\dbch\af23\loch\f2 2) Load your regular expression by function }{\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 LoadRule()}{\dbch\af23
|
|
\par \hich\af2\dbch\af23\loch\f2 \tab 3) Call function }{\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 Match()}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 to do the search in supplied tex\hich\af2\dbch\af23\loch\f2 t.
|
|
\par
|
|
\par
|
|
\par \hich\af2\dbch\af23\loch\f2 Now how it works.
|
|
\par \hich\af2\dbch\af23\loch\f2 There are two steps in the work -1)load regular expression and 2) search the
|
|
\par \hich\af2\dbch\af23\loch\f2 text
|
|
\par
|
|
\par \hich\af2\dbch\af23\loch\f2 1)load regular expression
|
|
\par \hich\af2\dbch\af23\loch\f2 When you are loading regular expression, }{\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 LoadRule()}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 calls function }{\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 Parse()}{\dbch\af23
|
|
\hich\af2\dbch\af23\loch\f2
|
|
\par \hich\af2\dbch\af23\loch\f2 that has a huge switch. This function do \hich\af2\dbch\af23\loch\f2 parsing of the rule and create tags
|
|
\par \hich\af2\dbch\af23\loch\f2 of different types for every sequences of special characters, depends on the
|
|
\par \hich\af2\dbch\af23\loch\f2 type of special characters. For some special characters founded it calls
|
|
\par \hich\af2\dbch\af23\loch\f2 appropriate functions like }{\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 GetAsciiChar()}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 or }{\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 GetEither()}{\dbch\af23
|
|
\hich\af2\dbch\af23\loch\f2 to d\hich\af2\dbch\af23\loch\f2 o this special
|
|
\par \hich\af2\dbch\af23\loch\f2 parsing. The tags are added to the collection of tags. Any tag can be
|
|
\par \hich\af2\dbch\af23\loch\f2 retrieved by }{\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 GetTag()}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 . The function Parse is virtual, so, if you need to
|
|
\par \hich\af2\dbch\af23\loch\f2 process some special characters, that are not specified here, you can override
|
|
\par \hich\af2\dbch\af23\loch\f2 it. Onc\hich\af2\dbch\af23\loch\f2 e }{\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 Parse()}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 or called subfunction found error, Parce stops parsing and
|
|
\par \hich\af2\dbch\af23\loch\f2 returns FALSE. You can retrieve error code by }{\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 GetError()}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 and translate it to
|
|
\par \hich\af2\dbch\af23\loch\f2 description by }{\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 TranslateError()}{\dbch\af23
|
|
\par
|
|
\par \hich\af2\dbch\af23\loch\f2 2) search the text
|
|
\par \hich\af2\dbch\af23\loch\f2 The search text makes function }{\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 Match()}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 that call r\hich\af2\dbch\af23\loch\f2 ecursive function
|
|
\par \hich\af2\dbch\af23\loch\f2 }{\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 MatchNextTag()}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 with start tag number=0. }{\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 Match()}{\dbch\af23 \hich\af2\dbch\af23\loch\f2
|
|
does loop, every time
|
|
\par \hich\af2\dbch\af23\loch\f2 incrementing start position in the supplied text for the search untill end of
|
|
\par \hich\af2\dbch\af23\loch\f2 the text has been reached. }{\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 MatchNextTag()}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 does main job and once the tag
|
|
\par \hich\af2\dbch\af23\loch\f2 matches the text at the specified position does either, call }{\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 OnMatch()}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 if the
|
|
\par \hich\af2\dbch\af23\loch\f2 tag was last in the collection of the tags or calls }{\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 MatchNextTag()}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 to match
|
|
\par \hich\af2\dbch\af23\loch\f2 next tag from the collection.
|
|
\par
|
|
\par \hich\af2\dbch\af23\loch\f2 The function }{\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 MatchNextTag()}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 like }{\b\cf2\dbch\af23 \hich\af2\dbch\af23\loch\f2 Parse()}{\dbch\af23 \hich\af2\dbch\af23\loch\f2 is
|
|
\par \hich\af2\dbch\af23\loch\f2 virtual, so, it\hich\af2\dbch\af23\loch\f2 's up to you override it if you want to process some special
|
|
\par \hich\af2\dbch\af23\loch\f2 sequences.
|
|
\par }} |