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

Potential Update for Rails7 with Ruby3.1 #5721

Open
mikeh-dev opened this issue Oct 24, 2024 · 2 comments
Open

Potential Update for Rails7 with Ruby3.1 #5721

mikeh-dev opened this issue Oct 24, 2024 · 2 comments

Comments

@mikeh-dev
Copy link

mikeh-dev commented Oct 24, 2024

# config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i

Environment

  • Ruby 3.1.2
  • Rails 7.0.7
  • Devise 4.9.4

Current behaviour

I ran into a failing test with Rspec on the valid email check

The original regex here;

config.email_regexp =/^([\w.%+-]+)@([\w-]+.)+([\w]{2,})$/i

was failing on a new line error

Solution

I corrected to

/\A([\w.%+-]+)@([\w-]+.)+([\w]{2,})\z/i

Basically the same but changing the start and end removed the multiline anchors error for me.
OLD uses ^ and $: Matches start/end of any line
NEW uses \A and \z: Matches start/end of entire string

Not sure if this is correct as this is my first contribution but I came across and thought I would drop it in.

Cheers

@JalisoCSP
Copy link

Seems legit to me

You should make a PR :) 👏

@mikeh-dev
Copy link
Author

Seems legit to me

You should make a PR :) 👏

Cheers! I'll get onto it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants