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

regex tips #5

Open
dcarosone opened this issue Mar 27, 2019 · 1 comment
Open

regex tips #5

dcarosone opened this issue Mar 27, 2019 · 1 comment

Comments

@dcarosone
Copy link

Two tips for regex usage:

  • you're working with non-utf8 bytes, [u8]; look at the bytes submodule in the Regex crate. This will avoid a bunch of the mess inside each match arm that's trying to conver to strings and back.
  • avoid compiling the regex each time around the loop, using the lazy_static! method noted in the regex docs.
@JamesFysh
Copy link
Contributor

How is lazy_static not part of the standard library at this point?!

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

No branches or pull requests

2 participants