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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:56:24+00:00 2026-06-04T10:56:24+00:00

I have various strings with different information but they all share one common characteristic:

  • 0

I have various strings with different information but they all share one common characteristic: they contain the username of the requester with brackets right after it. Something like: "... paul [55] ..." I am trying to write a regex that is able to extract the word right before the [dd]

This is what I have so far: "/(?P<user>\w+)\s\[\d\d\]/" but this only works if the string starts with the user, such as "paul [55] has logged in" but it wouldn’t work in the case, "user paul [55] has logged off"

What am I missing?

  • 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-04T10:56:24+00:00Added an answer on June 4, 2026 at 10:56 am

    Try using positive lookahead assertion:

    (\w+)(?=\s?\[\d\d\])
    

    This expression matches one or more word characters only if it is followed by an optional space and a double-digit decimal number enclosed in square brackets.

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

Sidebar

Related Questions

i have various strings that look like that: $(gateway.jms.jndi.ic.url,0,tibjmsnaming, tcp)/topic/$(gateway.destination.prefix)$(gateway.StatusTopicName),$(gateway.jms.jndi.ic.username),$(gateway.jms.jndi.ic.password),abinding,tBinding i'm trying to figure
I have various HTML strings to cut to 100 characters (of the stripped content,
I have read a file into a String. The file contains various names, one
I have a database where a misspelled string appears in various places in different
Firstly, Im new to android but have years of various other programming experience on
I have strings stored in various objects, for example a, b, c[2:7] (ie 5
I have looked at various methods ranging from string.erase/ ispunct etc. and I cant
I have a class that has an Action<string> called DisplayData ; In various points
I have various time-series I'd like to correlate and present as either a csv-file
I have various settings in my ccnet.config file and wish to pass them to

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.