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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:05:47+00:00 2026-06-11T11:05:47+00:00

I have a string: 2012-szept-17 02:55 – someproblem: 192.167.1.1 since – $somevariables[0] $morevariables[-1] and

  • 0

I have a string:

"2012-szept-17 02:55 - someproblem: 192.167.1.1 since - $somevariables[0] $morevariables[-1]"

and I want to get these out of it into an array

$somevariables[0]
$morevariables[-1]

The problem is that these variables can be named anything else and they could be anywhere in the string. The only thing I know about them is that they start with $ and have [sg] in the end.

This is the furthest I got with the regexp

my @fuu = $notimsg =~ m/(\$.+\[.+\])/g;

The problem is that the expression is making this into "$somevariables[0] $morevariables[-1]"

  • 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-11T11:05:47+00:00Added an answer on June 11, 2026 at 11:05 am

    If they must be valid variable names (identifiers), then try

    m/(\$\w+\[[^]]+\])/g
    

    As @Borodin points out, if you really want to make sure you match only identifiers (and not something strange like $3abc[12]), you can use

    m/(\$[a-z_]\w*\[[^]]+\])/gi
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this string 2012-06-27 16:17:06 and I want to convert it to GMT
Hi i have the following string:2012-05-20T09:00:00.000Z and i want to format it to be
I have this string: var someString = 23/03/2012; and want to replace all the
I have string 24 Jan 2012 09:21:21 +0000 and I want to make it
I have a date/time string like 2012-01-13 04:37:20 but I want to convert it
I have the string: 20120113083000Z and I want to convert it to: 2012 01
I have date string 18-2-2012 , from this how to get the current day
I have this as a string 02/06/2012 1:25 PM EST I want to use
I have a string similar to 2012-06-14 20:38:24.213-7:00 and want to convert it to
I have a string NSString *Original=@88) 12-sep-2012; or Original=@8) blablabla; I want to print

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.