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

  • Home
  • SEARCH
  • 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 3360586
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:00:37+00:00 2026-05-18T03:00:37+00:00

Given the string: © 2010 Women’s Flat Track Derby Association (WFTDA) I want: 2010

  • 0

Given the string:

 © 2010 Women’s Flat Track Derby Association (WFTDA) 

I want:

2010 -- Women's -- Flat
Women's -- Flat -- Track
Track -- Derby -- Association

I’m using regex:

([a-zA-Z]+)\s([A-Z][a-z]*)\s([a-zA-Z]+)

It’s only returning:

s -- Flat -- Track
  • 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-05-18T03:00:37+00:00Added an answer on May 18, 2026 at 3:00 am

    This problem isn’t straightforward, but to understand why, you need to understand how the regular expression engine operates on your string.

    Let’s consider the pattern [a-z]{3} (match 3 successive characters between a and z) on the target string abcdef. The engine starts from the left side of the string (before the a), and sees that a matches [a-z], so it advances one position. Then, it sees that b matches [a-z] and advances again. Finally, it sees that c matches, advances again (to before d) and returns abc as a match.

    If the engine is set up to return multiple matches, it will now try to match again, but it keeps its positional information (so, like above, it’ll match and return def).

    Because the engine has already moved past the b while matching abc, bcd will never be considered as a match. For this same reason, in your expression, once a group of words is matched, the engine will never consider words within the first match to be a part of the next one.


    In order to get around this, you need to use capturing groups inside of lookaheads to collect matching words that appear later in the string:

    var str = "2010 Women's Flat Track Derby Association",
        regex = /([a-z0-9']+)(?=\s+([a-z0-9']+)\s+([a-z0-9']+))/ig,
        match;
    
    while (match = regex.exec(str))
    {
        var group1 = match[1], group2 = match[2], group3 = match[3];
        console.log("Found match: " + group1 + " -- " + group2 + " -- " + group3);
    }

    This results in:

    2010 -- Women's -- Flat
    Women's -- Flat -- Track
    Flat -- Track -- Derby
    Track -- Derby -- Association
    

    See this in action at http://jsfiddle.net/jRgXm/.

    The regular expression searches for what you seem to be defining as a word ([a-z0-9']+), and captures it into subgroup 1, and then uses a lookahead (which is a zero-width assertion, so it doesn’t advance the engine’s cursor), that captures the next two words into subgroups 2 and 3.

    However, if you are using the actual Javascript engine, you must RegExp.exec and loop over the results (see this question for a discussion of why) or use the new matchAll method (ES2020). I don’t know how UltraEdit’s engine is implemented, but hopefully it can do a global search and also collect subgroups.

    Just for completeness, here’s the example above using ES2020′ matchAll (the first element in each returned array is the total match, then the subsequent elements are the capture groups):

    const str = "2010 Women's Flat Track Derby Association";
    const regex = /([a-z0-9']+)(?=\s+([a-z0-9']+)\s+([a-z0-9']+))/ig;
    
    console.log([...str.matchAll(regex)]);
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given this string: Fri, 09 Apr 2010 14:10:50 +0000 how does one convert it
Given the string: /home 1020....2010 main I would like home , 1020 and 2010
Given a date in the following string format: 2010-02-02T08:00:00Z How to get the year
I have a filename in a string. I want to split the given string
Using JavaScript, I need to check if a given string contains a sequence of
How can I drop all tables whose names begin with a given string? I
Is there a way to determine the display length of a given string (in
I have a requirement to disallow backslash characters in a given string field defined
Is there a built-in function/method that can check if a given string is a
More specifically, I'm trying to check if given string (a sentence) is in Turkish.

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.