Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9175107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:51:39+00:00 2026-06-17T16:51:39+00:00

It seams that Both (a|e|i|o|u)? and [aeiou]? have the same effect, i wonder whether

  • 0

It seams that Both (a|e|i|o|u)? and [aeiou]? have the same effect, i wonder whether there is any significant difference on performance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:51:40+00:00Added an answer on June 17, 2026 at 4:51 pm

    in the example you give there is a significant benefit to using the class over the alternation.

    For example:

    string 'abcde'
    regex1 /(a|e|i|o|u)cde/
    regex2 /[aeiou]cde/
    

    appling either regex1 or regex2 to that string will fail however what goes on under the hood?

    Regex1 takes the first character of string and see’s if it matches the regex so it checks ‘a’ against (a|e|i|o|u) which matches, however the regex engine also notes that there are 4 other alternations that could be tested if this one fails later on. It then takes the second character of string and matches it against the second atomic group of the regex ‘c’ This causes the regex to fail, however it still has 4 other ‘states’ it can use to try and make a match so the regex engine will go back a step and try to match the first character of the string against e i o u before deciding that the regex will fail completely and exit.

    Regex 2 on the other hand decides that the first character of the string ‘a’ is one of the characters in the class [aeiou] no further states are created and therefore when the second character fails to match it exits with a failure, much quicker than regex1.

    There is a lot more to how regex internals work as there are two types of engine (deterministic and non deterministic) but if you’re interested in reading more regular-expressions.info has a very good detailed description of what is going on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Which call is correct ? Seems that both calls have same result. UIImage *img
I have two T-SQL scalar functions that both perform calculations over large sums of
I have two chained CascadingDropDowns . Both are working fine. The thing is that
Pixel Perfect https://addons.mozilla.org/en-US/firefox/addon/pixel-perfect/ Is not working any more on FF6 and seams that they
I have a QT application that requires the MySql driver. I have both a
In this example seems that both strings jesus are equals(same memory location). printf(%p\n,jesus); printf(%p\n,jesus);
It seems that both git and mercurial are rather Linux oriented. Which of them
It seems that both of them could make the element move from its current
It seems to me that both interface and abstract function are quite similar, it's
For example: #define FOO(x) (printf(x)) and #define FOO(x) {printf(x)} It seems that both are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.