diff -uNr bregexp-1.0/Makefile.WIN32 bregexp-1.04/Makefile.WIN32
--- bregexp-1.0/Makefile.WIN32	1970-01-01 09:00:00.000000000 +0900
+++ bregexp-1.04/Makefile.WIN32	2007-06-26 00:54:58.000000000 +0900
@@ -0,0 +1,54 @@
+#
+#   bregexp library make file   for WIN32
+#					version	1.0 1999.11.24 Tatsuo Baba
+#						    2006.08.21 K.Takata
+#
+#   bregexp.h	 			header file
+#   bregexp.dll				shared library
+#   bregexp.lib				static library
+#
+#
+
+CC = cl
+CPP = cl
+CPPFLAGS = /O2 /W3 /GX /LD /nologo /D_CRT_SECURE_NO_DEPRECATE
+LD = link
+LDFLAGS = /DLL /nologo
+#
+HEADERFILE = bregexp.h
+LIBNAME = bregexp
+SHAREDLIBNAME = $(LIBNAME).dll
+STATICLIBNAME = $(LIBNAME).lib
+#
+#
+
+all : $(SHAREDLIBNAME)
+
+
+$(SHAREDLIBNAME) : main.obj bregcomp.obj bsubst.obj bregexec.obj bsplit.obj btrans.obj sv.obj
+	$(LD) $** /out:$@ $(LDFLAGS) /def:$(LIBNAME).def
+
+
+main.obj : main.cc sv.h bregexp.h global.h intreg.h
+
+bregexec.obj : bregexec.cc sv.h global.h intreg.h
+
+bregcomp.obj : bregcomp.cc sv.h global.h intreg.h
+
+bsubst.obj : bsubst.cc sv.h global.h intreg.h
+
+bsplit.obj : bsplit.cc sv.h global.h intreg.h
+
+btrans.obj : btrans.cc sv.h global.h intreg.h
+
+sv.obj : sv.cc sv.h
+
+clean : 
+	del *.obj
+	del $(STATICLIBNAME) $(SHAREDLIBNAME)
+
+
+.SUFFIXES : .cc
+.cc.obj:
+	$(CPP) $(CPPFLAGS) /c /TP $<
+
diff -uNr bregexp-1.0/bregcomp.cc bregexp-1.04/bregcomp.cc
--- bregexp-1.0/bregcomp.cc	1999-11-24 12:42:36.000000000 +0900
+++ bregexp-1.04/bregcomp.cc	2007-07-06 19:29:43.000000000 +0900
@@ -1501,7 +1501,7 @@
     return retval;
 }
 
-static char hexdigit[] = "0123456789abcdef0123456789ABCDEFx";
+static char hexdigit[] = "0123456789abcdef0123456789ABCDEF";
 
 unsigned long
 scan_hex(char *start, int len, int *retlen)
diff -uNr bregexp-1.0/bregexec.cc bregexp-1.04/bregexec.cc
--- bregexp-1.0/bregexec.cc	1999-11-24 12:42:20.000000000 +0900
+++ bregexp-1.04/bregexec.cc	2007-10-03 15:18:44.000000000 +0900
@@ -202,6 +202,10 @@
 	regprev = stringarg[-1];
 	if (!multiline && regprev == '\n')
 	    regprev = '\0';		/* force ^ to NOT match */
+#ifdef	KANJI
+	else if (KANJI_MODE && kpart(strbeg, stringarg-1) != KPART_OTHER)
+	    regprev = '\0';
+#endif
     }
     regprecomp = prog->precomp;
     regnpar = prog->nparens;
@@ -252,7 +256,17 @@
 	    goto phooey;	/* not present */
 	}
 	else if (prog->regback >= 0) {
+// insert by Okada 2005/10/20
+#ifdef	KANJI
+	    for (int LopCnt = 0; LopCnt < prog->regback; LopCnt++) {
+		s--;
+		if (s && KANJI_MODE && kpart(startpos, s) == KPART_KANJI_2) {
+		    s--;
+		}
+	    }
+#else	/* KANJI */
 	    s -= prog->regback;
+#endif	/* ! KANJI */
 	    if (s < startpos)
 		s = startpos;
 	    minlen = prog->regback + SvCUR(prog->regmust);
@@ -397,8 +411,15 @@
 	    if (minlen)
 		dontbother++,strend--;
 	    if (s != startpos) {
-		i = s[-1];
-		tmp = isALNUM(i);
+#ifdef	KANJI
+		if (KANJI_MODE && kpart(strbeg, s-1) != KPART_OTHER)
+		    tmp = 0;
+		else
+#endif
+		{
+		    i = s[-1];
+		    tmp = isALNUM(i);
+		}
 	    }
 	    else
 		tmp = isALNUM(regprev);	/* assume not alphanumeric */
@@ -421,8 +442,15 @@
 	    if (minlen)
 		dontbother++,strend--;
 	    if (s != startpos) {
-		i = s[-1];
-		tmp = isALNUM(i);
+#ifdef	KANJI
+		if (KANJI_MODE && kpart(strbeg, s-1) != KPART_OTHER)
+		    tmp = 0;
+		else
+#endif
+		{
+		    i = s[-1];
+		    tmp = isALNUM(i);
+		}
 	    }
 	    else
 		tmp = isALNUM(regprev);	/* assume not alphanumeric */
@@ -781,6 +809,10 @@
 	case BOUND:
 	    if (locinput == regbol)	/* was last char in word? */
 		ln = isALNUM(regprev);
+#ifdef	KANJI
+	    else if (KANJI_MODE && kpart(regbol, locinput-1) != KPART_OTHER)
+		ln = 0;
+#endif
 	    else 
 		ln = isALNUM(locinput[-1]);
 	    n = isALNUM(localNextchar); /* is next char in word? */
diff -uNr bregexp-1.0/bregexp.def bregexp-1.04/bregexp.def
--- bregexp-1.0/bregexp.def	1970-01-01 09:00:00.000000000 +0900
+++ bregexp-1.04/bregexp.def	2007-06-26 00:54:10.000000000 +0900
@@ -0,0 +1,8 @@
+LIBRARY BREGEXP
+EXPORTS
+		BMatch
+		BSubst
+		BTrans
+		BSplit
+		BRegfree
+		BRegexpVersion
diff -uNr bregexp-1.0/bsubst.cc bregexp-1.04/bsubst.cc
--- bregexp-1.0/bsubst.cc	1999-11-24 12:43:50.000000000 +0900
+++ bregexp-1.04/bsubst.cc	2007-06-26 02:01:24.000000000 +0900
@@ -224,8 +224,8 @@
 					memcpy(buf+copycnt, rep->startp[i], dlen);
 					copycnt += dlen;
 				}
-
-				else if (dlen <= rx->nparens && rx->startp[dlen]) {
+				// rx->endp[dlen] != NULL ‚ð’Ç‰Á‚µ�A–¢’è‹`\number‚ð’uŠ·Žž‚ÌˆÙ�í�I—¹–hŽ~ 2006/06/24 ‚©‚ë‚Æ
+				else if (dlen <= rx->nparens && rx->startp[dlen] && rx->endp[dlen]) {
 					len = rx->endp[dlen] - rx->startp[dlen];
 					if (blen <= copycnt + len) {
 						char *tp = new char[blen + len + 256];
@@ -332,7 +332,7 @@
 		}
 		p++;
 		if (p >= pend) {
-			*dst++ = '\\';
+			*dst++ = p[-1];
 			break;
 		}
 		if (p[-1] == '$') {		// $ ?
diff -uNr bregexp-1.0/btrans.cc bregexp-1.04/btrans.cc
--- bregexp-1.0/btrans.cc	1999-11-24 12:44:30.000000000 +0900
+++ bregexp-1.04/btrans.cc	2007-06-26 01:58:14.000000000 +0900
@@ -243,9 +243,11 @@
 		    ender = toUPPER(ender);
 		ender ^= 64;
 		break;
-    case '0':
+    case '0': case '1': case '2': case '3':
+    case '4': case '5': case '6': case '7':
 		--p;
 	    ender = (char)scan_oct(p, 3, &numlen);
+		--numlen;
 		break;
     case '\0':
 		/* FALL THROUGH */
