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

Fix #11 #12

Merged
merged 1 commit into from
Oct 7, 2022
Merged

Fix #11 #12

merged 1 commit into from
Oct 7, 2022

Conversation

Riey
Copy link
Owner

@Riey Riey commented Oct 6, 2022

No description provided.

@ruby-textark
Copy link

여전히 제대로 작동하지 않네요
Greedy matching때문에 모든 버튼이 최대 2개까지밖에 추출되지 않습니다

image

그리고 혹시 아래의 작동을 의도하신 거라면 /[^\[]*?\[ *(\d ) *\][^\[]*/ 으로 해결할 수 있을 것 같습니다만
image

개인적으로는 모든 버튼이 시작하기 이전의 텍스트는 그대로 텍스트로 추출하고 버튼은 무조건 [ ... ] 패턴 이후에 나온 문자열만 지니게 하는것이 더 좋아보입니다.

만일 그렇다면 다음 정규식 중 하나면 제대로 돌아갈 것 같습니다

  1. 버튼 value로 임의의 값이 들어올 수 있는 경우 /\[([^\]] )\][^\[]*/
  2. 버튼 value로 문자열이 들어올 수는 있으나 앞뒤의 공백을 trim해야 하는 경우 /\[\s*([^\]] )\s*\][^\[]*/
  3. 버튼 value로 숫자만 입력받을 경우 /\[\s*(\d )\s*\][^\[]*/

@Riey
Copy link
Owner Author

Riey commented Oct 7, 2022

개인적으로는 모든 버튼이 시작하기 이전의 텍스트는 그대로 텍스트로 추출하고 버튼은 무조건 [ ... ] 패턴 이후에 나온 문자열만 지니게 하는것이 더 좋아보입니다.

이러면 Emuera랑 동작이 달라져서 안됩니다 예를들어 커맨드 [0] 커맨드 [1] 이런 형식의 버튼이면 의도랑 다르게 작동합니다

@Riey Riey merged commit f2ab3d1 into master Oct 7, 2022
@Riey Riey deleted the issues/11 branch October 7, 2022 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants