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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:33:10+00:00 2026-05-22T23:33:10+00:00

In my tokenizer (.lex) file I want to match the following pattern : AaBC12/awD41/dfs21

  • 0

In my tokenizer (.lex) file I want to match the following pattern :

AaBC12/awD41/dfs21 etc...

I’ve written this rule

[A-Za-z]+[A-Za-z0-9]*[[/]+[A-Za-z][A-Za-z0-9]*]* 
{lline = cpflineno;cpflval.str = strdup(cpftext);return K_IDENTIFIER;}

This rule seems correct to me but if i have an input like this :

TOP/MD1 
TOP/MD2
TOP/MD2/D/E

My output is

TOP/MD1
TOP/MD2
TOP/MD2
/D/E  

instead of

TOP/MD1
TOP/MD2
TOP/MD2/D/E

Could you tell me where my rule fails ?

  • 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-22T23:33:11+00:00Added an answer on May 22, 2026 at 11:33 pm

    What about this:

    [A-Za-z]+[A-Za-z0-9]*([/]+[A-Za-z][A-Za-z0-9]*)* 
    

    Replaced [] with () where you mean a group.

    Note that it will match foo////bar, if you don’t want that remove the second + (and the first + for that matter too, it’s useless in this case).

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

Sidebar

Related Questions

This an optimized version of the tokenizer that was first written, and it works
I've one file, main.rb with the following content: require tokenizer.rb The tokenizer.rb file is
I am writing a script to tokenize file contents. I've written a tokenizer in
Overview Although this question implicates lex/yacc, which are written in C, it's fundamentally centered
I have a YACC (Bison) grammar, a Lex (Flex) tokenizer, and a C program
I am trying to read contents of a file using string tokenizer and store
right now I am a little bit confused. I want to manipulate this string
I am using Jquery tokenizer as like facebook using the following plugin http://loopj.com/jquery-tokeninput/ which
i'm trying to read a file into my python program and apply tokenizer on
I am trying to read 200,000 records from a file and then use tokenizer

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.