Microsoft Office Access `LIKE` VS `RegEx` [英] Microsoft office Access `LIKE` VS `RegEx`

查看:42
本文介绍了Microsoft Office Access `LIKE` VS `RegEx`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在访问关键术语 LIKE 和它的使用方面遇到了问题.我想在查询表单中使用以下 RegEx(正则表达式)作为一种验证规则",其中 LIKE 运算符过滤我的结果:

I have been having trouble with the Access key term LIKE and it's use. I want to use the following RegEx (Regular Expression) in query form as a sort of "verfication rule" where the LIKE operator filters my results:

"^[0]{1}[0-9]{8,9}$"

如何实现?

推荐答案

我认为 Access 不允许正则表达式匹配(在 VBA 中除外,但这不是您要问的).LIKE 运算符甚至不支持交替.

I don't think Access allows regex matches (except in VBA, but that's not what you're asking). The LIKE operator doesn't even support alternation.

因此您需要将其拆分为两个表达式.

Therefore you need to split it up into two expressions.

... WHERE (Blah LIKE "0#########") OR (Blah LIKE "0########")

(# 在 Access 中表示一位数").

(# means "a single digit" in Access).

这篇关于Microsoft Office Access `LIKE` VS `RegEx`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆