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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:20:32+00:00 2026-06-03T09:20:32+00:00

I am familiar with Regular Expressions, but this complex example is tripping me up.

  • 0

I am familiar with Regular Expressions, but this complex example is tripping me up. I trying to understand what this line of code is doing:

r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/([gim]+\b|\B)'

It is a code snippet that is trying to detect a regular expression, for example: /\s+/. I understand it until the nested [, \[, and the ( counterparts.

(I need to port this code from Python to Java and am having problems understanding how the above works, and why it does not work as is in Java.)

  • 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-03T09:20:33+00:00Added an answer on June 3, 2026 at 9:20 am

    Here’s an exploded version that might help:

    /                      # Match an opening slash
    (                      # Followed by one or more...
      \\.                  #    Backslash followed by any character
      |                    #   or...
      [^[/\\\n]            #    Something that's not a [, /, \, or newline
      |                    #   or...
      \[                   #    A literal [, followed by any number of...
        (
          \\.              #     backslashes followed by any character
          |                #     or...
          [^\]\\\n]        #     something that's not a ], \, or newline
        )*
      ]                    #    and ending with a ]
    )+
    /                      # And a closing slash
    (
      [gim]+\b             # Followed by one or more of g, i, m
      |
      \B                   # or something that isn't a word boundary
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

src.match(/^(https?\:\/\/.*)\//) I know regular expressions but the syntax is not familiar to me. Can
I know this could probably be done without regular expressions, but I'd rather make
I'm not too familiar with networking in JAVA but what i'm basically trying to
A specific example: becoming familiar with django's project source code (core, contrib, utils, etc.).
I am not much familiar with regular expressions. I want help for following regular
Consider the following regular expressions: 7+ (7)+ Does anyone that is very familiar with
I'm not much familiar with Regular expressions. I've a string from which I need
I am not very familiar with Regular expression, but I am asked to modify
I am quite familiar with regular usage patterns of Core Data, but recently stumbled
I'm not familiar with ADO.NET Data Services but it looks usable. All I need

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.