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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:28:13+00:00 2026-05-23T15:28:13+00:00

/[^\\]\]/ What does this regex match to? Trying to match ] somehow. I am

  • 0
/[^\\]\]/

What does this regex match to?

Trying to match “]” somehow. I am not sure how exactly.

Thanks in advance.

  • 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-23T15:28:14+00:00Added an answer on May 23, 2026 at 3:28 pm

    It matches any single character that isn’t a backslash \, followed by a closing square bracket ].

    These strings match:

    "[]" =~ /[^\\]\]/;       # []
    "[abc]def" =~ /[^\\]\]/; # c]
    

    These strings don’t match:

    "]" =~ /[^\\]\]/;        # No character preceding ]
    "[\]" =~ /[^\\]\]/;      # Backslash preceding ]
    

    If you’re trying to match a ] as long as it’s not preceded by a \, use a negative lookbehind assertion instead of a negative character class:

    /(?<!\\)\]/
    

    (or see comments)

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

Sidebar

Related Questions

In regards to this: http://stackoverflow.uservoice.com/pages/general/suggestions/103227-parser-does-not-match-all-valid-urls is this regex adequate or will it need to
I am trying to match the following string in Javascript Regex PC123456 This is
I'm trying to match a string 123,1234 using regex.h. Following pattern does the job:
I am trying to deconstruct why this does not work in my (g)Vim console:
I have this regex: /.*v\=([\w-]+).*(&autoplay\=1)?/ Which I am trying to match against: http://www.youtube.com/watch?v=awmLS6GCJno&width=1000&height=300&autoplay=1 This
What does this mean exactly? I'm doing something like this: File.Copy(@\\foo\bar\baz.txt, @c:\test\baz.txt); MSDN doesn't
Why does this lambda expression not compile? Action a = () => throw new
I'm having trouble with an Expect regular expression. I'm trying to match on this
I'm trying to find a regex that works to match a string of escape
I'm trying to write a regex to match entries in delimited files that have

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.