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 7659955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:24:04+00:00 2026-05-31T13:24:04+00:00

Is there any application for a regex split() operation that could not be performed

  • 0

Is there any application for a regex split() operation that could not be performed by a single match() (or search(), findall() etc.) operation?

For example, instead of doing

subject.split('[|]')

you could get the same result with a call to

subject.findall('[^|]*') 

And in nearly all regex engines (except .NET and JGSoft), split() can’t do some things like “split on | unless they are escaped \|” because you’d need to have unlimited repetition inside lookbehind.

So instead of having to do something quite unreadable like this (nested lookbehinds!)

splitArray = Regex.Split(subjectString, @"(?<=(?<!\\)(?:\\\\)*)\|");

you can simply do (even in JavaScript which doesn’t support any kind of lookbehind)

result = subject.match(/(?:\\.|[^|])*/g);

This has led me to wondering: Is there anything at all that I can do in a split() that’s impossible to achieve with a single match()/findall() instead? I’m willing to bet there isn’t, but I’m probably overlooking something.

(I’m defining “regex” in the modern, non-regular sense, i. e., using everything that modern regexes have at their disposal like backreferences and lookaround.)

  • 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-31T13:24:04+00:00Added an answer on May 31, 2026 at 1:24 pm

    The purpose of regular expressions is to describe the syntax of a language. These regular expressions can then be used to find strings that match the syntax of these languages. That’s it.

    What you actually do with the matches, depends on your needs. If you’re looking for all matches, repeat the find process and collect the matches. If you want to split the string, repeat the find process and split the input string at the position the matches where found.

    So basically, regular expression libraries can only do one thing: perform a search for a match. Anything else are just extensions.

    A good example for this is JavaScript where there is RegExp.prototype.exec that actually performs the match search. Any other method that accepts regular expression (e. g. RegExp.prototype.test, String.prototype.match, String.prototype.search) just uses the basic functionality of RegExp.prototype.exec somehow:

    // pseudo-implementations
    RegExp.prototype.test = function(str) {
        return RegExp(this).exec(str);
    };
    String.prototype.match = function(pattern) {
        return RegExp(pattern).exec(this);
    };
    String.prototype.search = function(pattern) {
        return RegExp(pattern).exec(this).index;
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any application that will read a MySQL database table and generate a
Is there any recommended Java application profiling tutorial? I am now using JProfiler and
Is there any way for an application to determine the parameters and paramter types
Is there any difference between website and web application project? What if you are
Is there any reason to start a GUI program (application for Windows) written in
Is there any way to automatically launch an application on USB attach or CD
Is there any way to write Shoes application using IDE (NetBeans for example)? I
Is there any way for a web application to access the location data of
Are there any problems converting a Visual Foxpro 6 application to Visual Foxpro 9;
Is there any open source web client php application without popup server configuration ,

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.