正则表达式在querydsl中的应用

huangapple 未分类评论48阅读模式
英文:

REGEX within querydsl

问题

return property.value.eq(value)
                .or(property.value.startsWith(value + ","))
                .or(property.value.endsWith("," + value))
                .or(property.value.like("%," + value + ",%"));

这段代码的功能相当明确,它查找以下情况:...,valuevalue,......,value,...value

在使用 QueryDSL 中,是否有一种方法可以在查询中使用正则表达式(REGEX),以便将此表达式简化为一行?

英文:

I have the following code:

return property.value.eq(value)
                .or(property.value.startsWith(value + ","))
                .or(property.value.endsWith("," + value))
                .or(property.value.like("%," + value + ",%"));

What it does is pretty self-explanatory, it looks for the following scenarios ...,value, value,..., ...,value,..., value.

Is there a way to use REGEX within a query using QueryDSL in order to simplify this expression to one line?

huangapple
  • 本文由 发表于 2020年5月5日 06:13:45
  • 转载请务必保留本文链接:https://java.coder-hub.com/61602515.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定