Skip to content

Fixed regex#2

Merged
konbraphat51 merged 2 commits intokonbraphat51:devfrom
wannaphong:dev
Nov 1, 2023
Merged

Fixed regex#2
konbraphat51 merged 2 commits intokonbraphat51:devfrom
wannaphong:dev

Conversation

@wannaphong
Copy link

I added space and number. It is still fix your issues.

@konbraphat51
Copy link
Owner

Thanks, but does this change anything?

On my understandings, [^\u0E00-\u0E7F]+ means “anything other than Thai characters”, which already implements your addition, so this changes could be just a redundant.

Could you show me the examples of the result of these changes?

@konbraphat51
Copy link
Owner

konbraphat51 commented Nov 1, 2023

re.match(r"[-a-zA-Z]+|\d+([,\.]\d+)*|[ \t]+|\r?\n|[^\u0E00-\u0E7F]+|", “ร”)
shows matches.
I guess it should be [-a-zA-Z]+|\d+([,\.]\d+)*|[ \t]+|\r?\n|[^\u0E00-\u0E7F]+

@konbraphat51
Copy link
Owner

konbraphat51 commented Nov 1, 2023

P.S. it seems that last | means “or ‘’(empty string)”, which makes matches with anything

@konbraphat51
Copy link
Owner

Oh, I understood now.

You want to separate “va21” to “va” and “21”, but my code shows “va21”match.
And the OR usage is like “early return”

In that case I think we should

  • delete the last |
  • Leave a comment of “early return” intention

@konbraphat51
Copy link
Owner

↑I will fix it that way. Please tell me if it’s not you inteded

@konbraphat51 konbraphat51 merged commit 29d0929 into konbraphat51:dev Nov 1, 2023
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.

2 participants

Comments