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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:19:09+00:00 2026-06-14T21:19:09+00:00

I have 4 rules rule1: match variable rule2: match Float rule3: match Integer rule4:

  • 0

I have 4 rules

rule1: match variable 
rule2: match Float 
rule3: match Integer 
rule4: [ \t] ; //skipping space, tabs 
rule5: \n ;

now I want to have a rule for matching error, anything else that is not ID,Float,Integer, eg:”&^()>~….”

So this is the rule I created:

. {   printf("found an error:%s\n",yytext);
      err_count++;
}

But there is something wrong, it catches an unknown token whenever scanner jumps to next line.

My input:

12+32+22:18,18
99558^8*6
15.~646(5
My output

    Found a number:12
    Found a error:+
    Found a number:32
    Found a error:+
    Found a number:22
    Found a error::
    Found a number:18
    Found a error:,
    Found a number:18
    Found a error:
    Found a number:99558
    Found a error:^
    Found a number:8
    Found a error:*
    Found a number:6
    Found a error:
    Found a float:15.
    Found a error:~
    Found a number:646
    Found a error:(
    Found a number:5

for debug purpose, I try to find out the token by enclose it with square bracket

. {
        printf("Found a error:[%s]\n",yytext);
        err_count++;
        }

bash show:
    Found a number:12
    Found a error:[+]
    Found a number:32
    Found a error:[+]
    Found a number:22
    Found a error:[:]
    Found a number:18
    Found a error:[,]
    Found a number:18
    ]ound a error:[
    Found a number:99558
    Found a error:[^]
    Found a number:8
    Found a error:[*]
    Found a number:6
    ]ound a error:[
    Found a float:15.
    Found a error:[~]
    Found a number:646
    Found a error:[(]
    Found a number:5

 redirect output to a txt file
    Found a number:12
    Found a error:[+]
    Found a number:32
    Found a error:[+]
    Found a number:22
    Found a error:[:]
    Found a number:18
    Found a error:[,]
    Found a number:18
    Found a error:[
    ]
    Found a number:99558
    Found a error:[^]
    Found a number:8
    Found a error:[*]
    Found a number:6
    Found a error:[
    ]
    Found a float:15.
    Found a error:[~]
    Found a number:646
    Found a error:[(]
    Found a number:5

Anyone know what causing the problem ? Thanks
And I can assure you rule5: \n ; is working properly, here is the proof

I add print to rule5"\n { printf("newline\n"); 

redirect output to a txt file
Found a number:12
Found a error:[+]
Found a number:32
Found a error:[+]
Found a number:22
Found a error:[:]
Found a number:18
Found a error:[,]
Found a number:18
Found a error:[
]
newline
Found a number:99558
Found a error:[^]
Found a number:8
Found a error:[*]
Found a number:6
Found a error:[
]
newline
Found a float:15.
Found a error:[~]
Found a number:646
Found a error:[(]
Found a number:5
Found a error:[
]
newline
Found a variable:T189_10
Found a error:[@]
Found a float:12.2
Found a error:[
]
newline
Found a number:1
Found a variable:ABB21u
Found a error:[=]
Found a variable:ier_
Found a error:[
]
newline
Found a error:[$]
Found a error:[%]
Found a error:[^]
  • 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-14T21:19:10+00:00Added an answer on June 14, 2026 at 9:19 pm

    you have to look for the carriage return character (\r), is it common for the windows system insert two character when is pressed the Return button, the two character are new line (\n) and carriage return (\r), add it in this way:

    rule4: [ \t\r]
    

    and it will work fine.

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

Sidebar

Related Questions

I have a grammar like this: Match one or more rule1 where rule1 is
Have a regex: .*? (rule1|rule2) (?:(rule1|rule2)|[^}])* (It's designed to parse CSS files, and the
I have this rules in apache: RewriteRule ^seccion/([^/\.]+)/?$ index.php?tipo=seccion&slug=$1 [L] RewriteRule ^seccion/([^/\.]+)/pag/([0-9]+)$ index.php?tipo=seccion&slug=$1&page=$2 [QSA,L]
I have a Firstname and Lastname fields, I have set rules to 'required' but
I have next rewrite rules: RewriteEngine ON RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}
I have some iptables rules which redirect requests for port 80 onto our application
I have two CSS rules following each other: .some td:first-child:before { content:url('path/to/image.png') ; }
I have the following method and interface: public object ProcessRules(List<IRule> rules) { foreach(IRule rule
In my makefile, I have a: include .depend I also have a depend: rules
I have my own routing rules in routes.php, defined for all the pages that

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.