discord_ex icon indicating copy to clipboard operation
discord_ex copied to clipboard

regex in msg_command_parse/1

Open Marqin opened this issue 9 years ago • 2 comments

I have some questions about this regex: ~r/!(.\w*:\w*:\w*|.\w*:\w*|.\w*){1}/

  • Is it intentionaly to not catch unicode characters? (lack of u flag after regex)
  • Why .\w*? I mean, why it can begin with any not-newline character, but then it has to be only word chars? Why eg. not just \w*?
  • Why is it using this regex and not just String.starts_with?/2 ? That way it would be easier to modify it to be able to use provided char instead of ! (I'd some problems when interpolating variable inside regex).

Marqin avatar Aug 25 '16 10:08 Marqin

Also, isn't that {1} obsolete here? Isn't it by default matched only once?

Marqin avatar Aug 25 '16 12:08 Marqin

I should have some time to finally do some refactoring after this upcoming week. I'll have to see what that will all include.

To make sure I give clear context to the library. It went from a scratch project needed within my group to something more verbose to open source. So some refactoring is expected.

rmcafee avatar Aug 26 '16 22:08 rmcafee