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

Parser, Variable are also captured in String #99

Open
theludovyc opened this issue Jun 6, 2022 · 8 comments
Open

Parser, Variable are also captured in String #99

theludovyc opened this issue Jun 6, 2022 · 8 comments
Labels
bug Something isn't working
Milestone

Comments

@theludovyc
Copy link
Collaborator

VARIABLE = "((?<char_tag>{NAME})\\.)?(?<var_name>{NAME})"

In "Test character" return Test.

@theludovyc theludovyc added the bug Something isn't working label Jun 11, 2022
@theludovyc
Copy link
Collaborator Author

For now, I don't know how to detect match are in string with regex

@Jeremi360
Copy link
Contributor

Jeremi360 commented Jun 11, 2022

For now, I don't know how to detect match are in string with regex

I'm not sure what you mean by this @theludovyc , can you elaborate on this topic ?

@theludovyc
Copy link
Collaborator Author

I don't know how to resolve this bug for now. I need to learn more about regex. If you or other already know how to solve it with regex, feel free to help :)

@Jeremi360
Copy link
Contributor

I want try to help you @theludovyc , but I'm not sure what you mean by , can you give example or something ?

For now, I don't know how to detect match are in string with regex

@theludovyc
Copy link
Collaborator Author

theludovyc commented Jun 12, 2022

For JumpIf I use Expression class. To dectect used variables I use this regex
VARIABLE = "((?<char_tag>{NAME})\\.)?(?<var_name>{NAME})"
You can write something like that
jump todo if test.name = "Test character"
When I use VARIABLE on test.name = "Test character" it return 3 match, test.name, Test and character.
First one is good but I don't want Test and character because they are in String.
So I need to update my regex and check if match are not in String.

@Jeremi360
Copy link
Contributor

jump todo if test.name = "Test character"
When I use VARIABLE on test.name = "Test character" it return 3 match, test.name, Test and character.
First one is good but I don't want Test and character because it is in String.
So I need to update my regex and check if match are not in String.

O I see you just want to catch string in regex.
I went to Godot Dialogue Manger repo from which I borrow regex approuch,
and there found this line: DialogueConstants.TOKEN_STRING: "^\".*?\"", - this regex should to it.

@theludovyc
Copy link
Collaborator Author

theludovyc commented Jun 13, 2022

First one is good but I don't want Test and character because they are in String.
O I see you just want to catch string in regex.

No, the opposite. I want to catch regex if they aren't in String.

@Jeremi360
Copy link
Contributor

Jeremi360 commented Jun 13, 2022

I try a bit of experiment on regex.com and found this solution: regexr.com/6nke5 ,
but you still need to check in code if string don't starts from "

@Jeremi360 Jeremi360 added duplicate This issue or pull request already exists and removed duplicate This issue or pull request already exists labels Apr 25, 2023
@Jeremi360 Jeremi360 reopened this Apr 25, 2023
@theludovyc theludovyc added this to the 2.1.3 milestone Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants