Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(formula): regexextract/regexmatch/regexreplace #3282

Merged
merged 5 commits into from
Oct 11, 2024

Conversation

wpxp123456
Copy link
Contributor

close dream-num/univer-pro#2328

Pull Request Checklist

  • Related tickets or issues have been linked in the PR description (or missing issue).
  • Naming convention is followed (do please check it especially when you created new plugins, commands and resources).
  • Unit tests have been added for the changes (if applicable).
  • Breaking changes have been documented (or no breaking changes introduced in this PR).

@wpxp123456 wpxp123456 added the qa:untested This PR is ready to be tested label Sep 2, 2024
Copy link

github-actions bot commented Sep 2, 2024

View Deployment

📑 Examples 📚 Storybook
🔗 Preview link 🔗 Preview link

Copy link

codecov bot commented Sep 2, 2024

Codecov Report

Attention: Patch coverage is 75.54348% with 90 lines in your changes missing coverage. Please review.

Project coverage is 31.27%. Comparing base (50ab0c3) to head (6402b26).
Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
...es/engine-formula/src/engine/utils/regexp-check.ts 66.78% 90 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #3282      +/-   ##
==========================================
+ Coverage   31.13%   31.27%   +0.13%     
==========================================
  Files        2254     2258       +4     
  Lines      116682   117050     +368     
  Branches    25641    25757     +116     
==========================================
+ Hits        36325    36603     +278     
- Misses      80357    80447      +90     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

regularExpressionValue = `${regularExpressionValue}`;

try {
const regex = new RegExp(regularExpressionValue, 'g');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

回溯咋办?

@oumomomo
Copy link

oumomomo commented Sep 2, 2024

REGEXMATCH函数:
单元格内输入=REGEXMATCH("13912345678", "^1[3456789]\d{9}$"),结果不一致
image

@univer-bot
Copy link

univer-bot bot commented Sep 2, 2024

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿

REGEXMATCH function:
Enter =REGEXMATCH("13912345678", "^1[3456789]\d{9}$") in the cell, but the results are inconsistent
image

@oumomomo
Copy link

oumomomo commented Sep 2, 2024

REGEXEXTRACT函数

1、单元格内输入=REGEXEXTRACT(B10,"[a-Z]+")/=REGEXEXTRACT("abcd","((((a"),计算结果未报错
image

2、飞书模板内的两条示例D列公式计算不出结果,C4单元格 计算错误
样张:https://xakbyahbro.feishu.cn/sheets/OV5ksD5z6hiJ9ktlmREcU5OonVd
image
image

3、C3单元格为false时,计算结果报错
样张:https://xakbyahbro.feishu.cn/sheets/OS3SsEdiFheHcktl770coreSnBg?sheet=bq4UIE
image

4、单元格内输入=REGEXEXTRACT("我的生日20220104","生日(2022\d+)")/=REGEXEXTRACT("我的生日20220104","生日(?:2022)(\d+)"),计算结果错误
image
image

5、单元格内输入=REGEXEXTRACT("111aaa111","(\d+)([a-z]+)(\d+)") ,计算结果不对
image

6、 单元格内输入=REGEXEXTRACT("abcd","((((a)b)c)d)"),计算结果为空
image

7、D1=The total is $123.45 or €987.65 单元格内输入=REGEXEXTRACT(D1, "[$€]\d{1,3}(,\d{3})*(.\d{2})?") 错误码不一致
image

8、E1等于Visit our website at https://www.example.com 单元格内输入=REGEXEXTRACT(E1, "https?://[^\s]+") 计算不出结果
image

@univer-bot
Copy link

univer-bot bot commented Sep 2, 2024

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿

REGEXEXTRACT function

  1. Enter =REGEXEXTRACT(B10,"[a-Z]+")/=REGEXEXTRACT("abcd","((((a") in the cell, and no error will be reported in the calculation result
    image

  2. The two example formulas in column D in the Feishu template cannot calculate the result, and the calculation in cell C4 is wrong.
    Samples: https://xakbyahbro.feishu.cn/sheets/OV5ksD5z6hiJ9ktlmREcU5OonVd
    image
    image

  3. When cell C3 is false, the calculation result will report an error.
    Sample sheet: https://xakbyahbro.feishu.cn/sheets/OS3SsEdiFheHcktl770coreSnBg?sheet=bq4UIE
    image

  4. Enter =REGEXEXTRACT("My birthday 20220104","Birthday(2022\d+)")/=REGEXEXTRACT("My birthday 20220104","Birthday(?:2022)(\d+)") in the cell, Calculation result is wrong
    image
    image

  5. Enter =REGEXEXTRACT("111aaa111","(\d+)([a-z]+)(\d+)") in the cell, and the calculation result is incorrect.
    image

  6. Enter =REGEXEXTRACT("abcd","((((a)b)c)d)") in the cell, and the calculation result is empty.
    image

  7. D1=The total is $123.45 or €987.65 Enter in the cell=REGEXEXTRACT(D1, "[$€]\d{1,3}(,\d{3})*(.\d{2}) ?") Error codes are inconsistent

image
  1. E1 is equal to Visit our website at https://www.example.com. Enter =REGEXEXTRACT(E1, "https?://[^\s]+") in the cell. The result cannot be calculated.
    image

@oumomomo
Copy link

oumomomo commented Sep 2, 2024

REGEXREPLACE函数
1、单元格内输入=REGEXREPLACE("Sheets","e{2}","X"),计算结果不对
image

2、单元格内输入=REGEXREPLACE("The event will be held on June 15, 2024.", "\b(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s+\d{1,2},\s+\d{4}\b", "[REDACTED]") 计算结果不对
image

@univer-bot
Copy link

univer-bot bot commented Sep 2, 2024

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿

REGEXREPLACE function

  1. Enter =REGEXREPLACE("Sheets","e{2}","X") in the cell, and the calculation result is incorrect.
    image

  2. Enter =REGEXREPLACE("The event will be held on June 15, 2024.", "\b(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch) in the cell )?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober )?|Nov(?:ember)?|Dec(?:ember)?)\s+\d{1,2},\s+\d{4}\b", "[REDACTED]") The calculation result is incorrect
    image

@univer-bot univer-bot bot removed the qa:untested This PR is ready to be tested label Sep 2, 2024
@oumomomo oumomomo added qa:verified This PR has already by verified by a QA and is considered good enough to be merge scope:data validation labels Sep 3, 2024
@univer-bot univer-bot bot removed the qa:rejected label Sep 3, 2024
@wzhudev wzhudev marked this pull request as draft September 7, 2024 02:44
limit?: number;
}

// 定义数字字符集(0-9)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use English comment

Copy link

github-actions bot commented Sep 18, 2024

Playwright test results

passed  14 passed

Details

stats  14 tests across 8 suites
duration  3 minutes, 22 seconds
commit  6402b26
info  For more information, see full report

@wpxp123456 wpxp123456 marked this pull request as ready for review October 11, 2024 06:56
@wpxp123456 wpxp123456 merged commit 7ce334f into dev Oct 11, 2024
9 checks passed
@wpxp123456 wpxp123456 deleted the feat/add-regexp-formula branch October 11, 2024 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
qa:verified This PR has already by verified by a QA and is considered good enough to be merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants