我正在尝试创建一个正则表达式以在“新序列号”之后获取值
输入字符串:[EXT] EOL Resolved : 343250; Serial Number : OLD123 ; New Serial Number : NEW123; UPS Tracking Number : UPSTRN123;
我需要输出为'NEW123'
尝试过:
Match(%K00291;"(?<=New Serial Number :)(.*;)";true)
但是我得到的输出为:NEW123; UPS Tracking Number : UPSTRN123;
答案 0 :(得分:2)
您应该使用@Table(name = "VOUCHER")
@DynamicUpdate
//@Data
@Setter
@Getter
public class Voucher extends Base {
@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinTable(name = "PROMOTION_CODE_PRODUCT",
joinColumns = @JoinColumn(name = "PROMOTION_CODE_ID"),
inverseJoinColumns = @JoinColumn(name = "PRODUCT_ID"))
private Set<Product> products;
@Column(name = "CODE", unique = true)
private String code;
@Column(name = "TYPE", nullable = false)
private String type;
@Lob
private String descriptions;
public int hasCode() {
return Objects.hashCode(getId());
}
}
@Entity
@Table(name = "PRODUCT")
//@Data
@Setter
@Getter
@DynamicUpdate
public class Product extends Base {
@ManyToMany(mappedBy = "products", fetch = FetchType.EAGER)
private Set<Voucher> promotionCodes;
@Column(name = "SERVICE_NAME", nullable = false)
private String serviceName;
@Column(name = "CATEGORY")
private String category;
@Column(name = "DESCRIPTION")
private String description;
public int hasCode() {
return Objects.hashCode(getId());
}
}
(.*?
-零或多个,但尽可能少),而不要使用*?
(直到最后 .*
)以在最近 ;
处停止匹配:
;
最后,如果您不想 include 尾随 ..."(?<=New Serial Number :)(.*?)(?=;)"...
进入比赛,我们将其设置为;