alibaba / alibaba/QLExpress

正则表达式中 \ 也会被吞

Open
#335 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
5.6k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

对于正则表达式的 \d 等符号也会丢失,有什么通用的方法解决转义符号丢失的问题吗

```java
REPLACEREG("xxx4ch", '(\d*)ch', "中间包第$1炉")
```

```java
public class ReplaceRegOperator extends Operator {

@Override
public Object executeInner(Object[] list) throws Exception {
if (list == null) {
return "";
}
if (list.length < 3) {
return list[0];
}
return ReUtil.replaceAll((CharSequence) list[0], (String) list[1], (String) list[2]);
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at ReplaceRegOperator.executeInner and trace the ReUtil.replaceAll call using the supplied Java expression '(\d*)ch'. Reproduce where the backslash is lost and define a regression case for preserving \d and replacement $1; done means the regular expression reaches replacement handling without losing its escape.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.