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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:54:31+00:00 2026-05-10T14:54:31+00:00

I am wondering if it is possible to extract the index position in a

  • 0

I am wondering if it is possible to extract the index position in a given string where a Regex failed when trying to match it?

For example, if my regex was ‘abc’ and I tried to match that with ‘abd’ the match would fail at index 2.

Edit for clarification. The reason I need this is to allow me to simplify the parsing component of my application. The application is an Assmebly language teaching tool which allows students to write, compile, and execute assembly like programs.

Currently I have a tokenizer class which converts input strings into Tokens using regex’s. This works very well. For example:

The tokenizer would produce the following tokens given the following input = ‘INP :x:’
:

Token.OPCODE, Token.WHITESPACE, Token.LABEL, Token.EOL 

These tokens are then analysed to ensure they conform to a syntax for a given statement. Currently this is done using IF statements and is proving cumbersome. The upside of this approach is that I can provide detailed error messages. I.E

if(token[2] != Token.LABEL) { throw new SyntaxError('Expected label');} 

I want to use a regular expression to define a syntax instead of the annoying IF statements. But in doing so I lose the ability to return detailed error reports. I therefore would at least like to inform the user of WHERE the error occurred.

  • 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. 2026-05-10T14:54:32+00:00Added an answer on May 10, 2026 at 2:54 pm

    I agree with Colin Younger, I don’t think it is possible with the existing Regex class. However, I think it is doable if you are willing to sweat a little:

    1. Get the Regex class source code (e.g. http://www.codeplex.com/NetMassDownloader to download the .Net source).
    2. Change the code to have a readonly property with the failure index.
    3. Make sure your code uses that Regex rather than Microsoft’s.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 62k
  • Answers 62k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Focus events might work; you might also want to consider… May 11, 2026 at 10:10 am
  • added an answer is it safe to send login info via ajax You… May 11, 2026 at 10:10 am
  • added an answer Its not the NOCOUNT thats causing this, your stored procedures… May 11, 2026 at 10:10 am

Related Questions

I am wondering if it is possible to extract the index position in a
I am wondering if it is possible to use Code Access Security, and a
I am wondering if it is possible to have a sort of thumbnail image
I am wondering if it is possible to validate parameters to (custom) .net attributes.
I am wondering if it is possible to see stored procs that are being
I have a *.MDB database file, and I am wondering if it is possible
I am wondering if there is a method or format string I'm missing in
I am wondering if anyone has any experience using a JQuery plugin that converts
I am wondering if someone can put a bit of an authoritative reference summary
I am wondering if there are any well-known algorithms that I should be aware

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.