我有一个XML
<Root>
<Child><p><b>The Perfect Fit for Any Space</b></p> <p>Challenging the essence of how we define a desktop PC, GIGABYTE engineers have developed an ultra compact PC with a brushed aluminum surface chassis design. Ideal for a broad range of computing applications at home or in the office, the BRIX expounds sheer simplicity and convenience. With a broad choice of processors covering the entire performance spectrum, the BRIX sets a new standard for desktop miniaturization that makes it perfect as a discreet HTPC/multimedia hub, an ultra-low power PC for the family, an office PC or as a digital signage unit.</p> <p><b>Intel® Celeron® Processor</b><br /><br />GIGABYTE BRIX supports Intel third-generation low-power quad-core SoC processors which feature power-efficient 10W Intel® Celeron models. From a simple internet access point to a high end multimedia station, the GIGABYTE BRIX a broad range of usage scenarios and the ultimate space flexibility. GIGABYTE BRIX is expected to deliver up to 23% improvement in productivity over previous generation.</p> <p><b>Supports DDR4 Memory</b></p> <p>GIGABYTE BRIX provides a 128-bit memory controller that supports DDR4 at up to 2400MHz. DDR4 is a type of synchronous dynamic random-access memory with a double data rate and high bandwidth interface. The primary advantages of DDR4 over its predecessor, DDR3, include higher module density and lower voltage requirements, coupled with higher data rate transfer speeds.</p> <p><b>Connecting the Future - USB Type-C™: The World's Next Universal Connector</b></p> <p><b>Reversible USB Type-C™ with USB 3.0</b><br />The USB Type-C™ is a new reversible connector that is loaded with useful features such as USB 3.0 support for 5 Gb/s transfer speed. </p> <p><b>USB 3.0 and Network Connectivity</b><br />GIGABYTE BRIX™ also includes a M.2 module offering IEEE 802.11ac Wi-Fi and the latest Bluetooth 4.2, providing connectivity for low power Bluetooth users to easily connect mobile devices.</p> <p><b>SuperSpeed 4K HD Entertainment</b></p> <p><b>Supporting the Newest Standards in Multimedia <br /></b>GIGABYTE ensures users won't be limited by the standards or connections on the BRIX, by including HDMI 2.0 and support for HDCP 2.2 users can rest assured that their device will be able to display content to its full potential. The BRIX supports native resolutions of 4K at 60Hz, presenting unrivaled visual clarity and stunning realism to owners of UHD displays.</p> <p><b>Multi-display productivity with HDMI 2.0 & DisplayPort</b><br />BRIX supports up to three independent displays through HDMI 2.0 and a DisplayPort without the need for an additional graphics card. Support for two display is only possible with daisy-chain connections through Display Port.</p> <p><b>Graphics that Captivate</b></p> <p>Intel® HD Graphics deliver 10% more performance than its predecessor. With the new media engine users are able to, watch, create, edit, share and game all with captivating visuals. This media engine offers HEVC 10-bit hardware acceleration which improves upon the 4K viewing and content creation performance significantly versus previous generation processors. The BRIX now has the ability to drive premium content up to 4K UHD, so users can enjoy amazing and vibrant multimedia experiences on compatible displays.</p> <p><b>2.5" Hard Drive Support</b></p> <p>Utilizing SATA III 6 Gb/s high speed data transfer technology, the GIGABYTE BRIXs supports the installation of one 2.5" SATA 6Gbps HDD or Solid State Drive (SSD) and one M.2 2280 SSD module. This allows for optimized storage configurations which combine fast M.2 performance with larger capacity 2.5" hard drive. </p></Child>
</Root>
let $a := /Root/Child/string()
当我执行fn:matches($a, $a)
时,会出现 XDMP-REGEX 错误。我不知道它是哪个字符失败的。
错误摘要
[1.0-ml] XDMP-REGEX: (err:FORX0002) fn:matches("<p><b>The Perfect Fit for Any Space</b></p> <p>Challenging the e...", "<p><b>The Perfect Fit for Any Space</b></p> <p>Challenging the e...") -- Invalid regular expression
答案 0 :(得分:1)
fn:matches()
用于测试正则表达式是否与字符串匹配。第二个参数必须是有效的正则表达式模式。
错误条件 如果$ pattern的值根据5.6.1正则表达式语法中所述的规则无效,则会引发动态错误[err:FORX0002]。
该元素的计算得出的字符串值不是有效的正则表达式。该字符串中有一些字符(例如/
)需要转义。另外,尽管它是有效的,但是除非您在该字符串中转义(
和)
,否则它将不会查找那些文字字符,它将尝试创建一个正则表达式捕获组。
与其尝试找出如何将随机字符串转换为有效的正则表达式的方法,不如使用其他字符串比较选项。
如果您要确定该节点的雾化字符串值是否相等,则可以使用eq
或=
运算符比较字符串值:
$a eq $a
如果要查看第二个参数是否包含在第一个参数值中,可以使用fn:contains()
,它将简单的字符串(没有正则表达式模式)用作参数值:
fn:contains($a, $a)
如果您要测试两个节点的相等性,而不仅仅是它们的计算字符串值,则可以使用fn:deep-equals()
。但是,当然,相同的变量将是相等的,因此比较fn:deep-equals($a, $a)
仍然没有意义。