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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:54:15+00:00 2026-06-13T03:54:15+00:00

What is the regular expression that’d match anything , except these strings: => ,

  • 0

What is the regular expression that’d match anything , except these strings:
=>, | ?

If you’re familiar with javacc, I’m trying to define my ANYTHING token as shown below:

TOKEN :
{
 <ARROW: "=>" >
|
 <ANYTHING: (["\u0001" - "\uffdc"])+>
|
 <PIPE: "|">
|
 <UPPER_CHAR: (["A"-"Z"])>
}

Thanks

  • 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-13T03:54:16+00:00Added an answer on June 13, 2026 at 3:54 am

    Try something like this:

    Test.jj

    options {
        STATIC = false ;
    }
    
    PARSER_BEGIN(Test)
    public class Test {
      public static void main(String[] args) throws Exception {
        Test parser = new Test(new java.io.StringReader("foo=>bar=baz|done"));
        parser.Parse();
      }
    }
    PARSER_END(Test)
    
    TOKEN :
    {
         < ARROW    : "=>" >
      |  < PIPE     : "|" >
      |  < ANYTHING : (~["=", "|"] | "=" ~[">"])+ >
    }
    
    void Parse() : 
    {} 
    {
      (Any())* <EOF>
    }
    
    void Any() :
    {Token t;}
    {
      ( t=<ARROW>    {System.out.println("ARROW    = '" + t.image + "'");}
      | t=<PIPE>     {System.out.println("PIPE     = '" + t.image + "'");}
      | t=<ANYTHING> {System.out.println("ANYTHING = '" + t.image + "'");}
      )  
    }
    

    Generate the parser classes:

    javacc Test.jj

    and run the main method:

    java Test

    will print the following for the input "foo=>bar=baz|done":

    ANYTHING = 'foo'
    ARROW    = '=>'
    ANYTHING = 'bar=baz'
    PIPE     = '|'
    ANYTHING = 'done'
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a regular expression that match everything between <anything> and I'm using this:
I've got a regular expression that I'm trying to match against the following types
What is the regular expression that can match the following 2 strings. Hi<Dog>Hi and
What's the Java regular expression that captures the entire key-value list (shown in bold
I have this Regular Expression that matches the following strings: <!-- 09-02-2009 ---> <!--
I have a regular expression that searches strings and then wraps them within certain
I need a regular expression that satisfy these rules: The maximum number of decimal
I need a regular expression that accepts everything except numbers and ( & )
I need a regular expression that will match any string containing at most 2
I need a regular expression that can match any url in img src tag

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.