From: Eric B. <er...@go...> - 2007-02-04 10:41:14
|
Colin Paul Adams wrote: > Does anyone know the details of the regular expression syntax matched > by class RX_PCRE_REGULAR_EXPRESSION? > > It's baffling me. > > For instance, the following regular expression: > > ^[abc]*$ > > fails to compile, but > > ^[abc]* > > compiles OK. I wrote the following test and it works: test_compile1 is -- Test feature 'compile'. local a_regexp: RX_PCRE_REGULAR_EXPRESSION do create a_regexp.make a_regexp.compile ("^[abc]*$") assert ("compiled1", a_regexp.is_compiled) assert ("recognizes1", a_regexp.recognizes ("aaabbbccc")) assert ("not_recognizes1", not a_regexp.recognizes ("aaabbbcccddd")) end So I don't know why it would not work for you. > I don't have great hopes of trying to get this to compile: > > ^[\i-[:]][\c-[:]]*$ > > (that's XPath regular expression syntax, derived from XML Schema - \i > and \c are all initial name characters and all name characters > respectively.) I think that would have to write a preparser that would translate XPath regular expressions into PCRE regular expressions. -- Eric Bezault mailto:er...@go... http://www.gobosoft.com |