how to create a regex for non-english letters with vba's regex 5.5 -
i'm working vba, , started using regex library, finding numerals and/or english text had no problem far, need use on text fields contain mix of numbers , hebrew letters (addresses has several possible formats).
i have managed use in "dumb" way, can find literals , short patterns (such as, finding combination means postal box - 2 letter combined non-letter non number between them), can't use \w
english - , make life whole lot better.
is there anyway create "custom" regular expressions , save them variables? example make (a regex single hebrew word):
regex.pattern = "(א|ב|ג|ד|ה|ו|ז|ח|ט|י|כ|ל|מ|נ|ס|ע|פ|צ|ק|ר|ש|ת|ם|ן|ף|ץ)+"
and save \מ
instance or \hw
(short hebrew word), need make several types of patterns , several possible formats recognize, , save me lot of frustration (as ide don't have best interactions hebrew letters).
you can create own character class, , use in code:
dim hw string hw = "[אבגדהוזחטיכלמנסעפצקרשתםןףץ]+" regex.pattern = "^" + hw + "$" ' match isolated hebrew word
or
regex.pattern = hw + " " + hw ' match 2 hebrew words separated space
however, cannot "name" address \hw
.
Comments
Post a Comment