killme2008 / killme2008/aviatorscript

正则表达式贪婪匹配问题

Open
#479 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
5.2k
Forks
906
PR merge metrics
No merged PRs in 30d

Description

let s = '甲状腺组织一块,大小约4cm×3.8cm×1.5cm,切面见一个灰白色边界不清肿物,大小约1.5cm×1.4cm×5cm'
let p = /甲状腺.*?肿物.*?大小.*?(\d+\.?\d?)cm/;
if s =~ p{
println($1);
return $1;
}else{
return nil;
}

输出:5
使用java Pattern类匹配返回的是1.5
问题:是不是不支持非贪婪匹配?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the script in the issue and compare its regular-expression result with Java Pattern using the same input and pattern. Trace AviatorScript's regex matching implementation to determine why the lazy expression captures 5 instead of 1.5. Done means the behavior matches the reported expectation or the discrepancy is clearly documented.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.