英文:
REGEX within querydsl
问题
return property.value.eq(value)
.or(property.value.startsWith(value + ","))
.or(property.value.endsWith("," + value))
.or(property.value.like("%," + value + ",%"));
这段代码的功能相当明确,它查找以下情况:...,value
、value,...
、...,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?
专注分享java语言的经验与见解,让所有开发者获益!
评论