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

The Archive Base Latest Questions

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

I have this string/content: @Salome , @Jessi H and @O’Ren were playing at the

  • 0

I have this string/content:

@Salome, @Jessi H and @O'Ren were playing at the @Lean‘s yard with “@Ziggy” the mouse.

Well, I am trying to get all names focuses above. I have used @ symbol to create like a hash to be used in my web. If you note, there are names with spaces between like @Jessi H and characters before and after like @Ziggy. So, I don’t my if you suggest me another way to manage the hash in another way to get it works correctly. I was thinking that for user that have white spaces, could write the hash with quotes like @"Jessi H". What do you think? Other examples:

@Lean's => @"Lean"'s  
@Jessi H => @"Jessi H"  
"@Jessi H" => (sorry, I don't know how to parse it)  
@O'Ren => @"O'Ren" 

What I have do?
I’m starting using regex in php, but some SO questions have been usefull for me to get started, so, these are my tries using preg_match_all function firstly:

Result of /@(.*?)[,\" ]/:

Array ( [0] => Salome [1] => Jessi [2] => Charlie [3] => Lean's [4] => Ziggy" ) )

Result of /@"(.*?)"/ for names like @"name":

Empty array

Guys, I don’t expect that you do it all for me. I think that a pseudo-code or something like this will be helpful to guide me to the right direction.

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

    Try the following regex: '/@(?:"([^"]+)|([^\b]+?))\b/'

    This will return two match groups, the first containing any quoted names (eg @"Jessi H" and @"O'Ren"), and the second containing any unquoted names (eg @Salome, @Leon)

    $matches = array();
    preg_match_all('/@(?:"([^"]+)|([^\b]+?))\b/', '@Salome, @"Jessi H" and @"O\'Ren" were playing at the @Lean\'s yard with "@Ziggy" the mouse.', $matches);
    print_r($matches);
    

    Output:

    Array
    (
        [0] => Array
            (
                [0] => @Salome
                [1] => @"Jessi H
                [2] => @"O'Ren
                [3] => @Lean
                [4] => @Ziggy
            )
    
        [1] => Array
            (
                [0] => 
                [1] => Jessi H
                [2] => O'Ren
                [3] => 
                [4] => 
            )
    
        [2] => Array
            (
                [0] => Salome
                [1] => 
                [2] => 
                [3] => Lean
                [4] => Ziggy
            )
    
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a String with this content: href=http://www.website.com/ /> [...] [...] I just want
I have to replace the content of this xml string through java <My:tag>value_1 22&#xA;value_2
I have this string <p><img src=http://www.foo.com/bar.jpg></p><p>other content here</p> I need to extract the src
I have this in my OnItemClick method. final String[] links = getResources().getStringArray(R.array.pokemon_stats); String content
I have this string text: <meta http-equiv=Content-Type content=text/html; charset=utf-8> <style type=text/css> body { font-family:
I have a json string like this: http://pastebin.com/ckUZadwL I'm trying to use gson to
I have this ImageView in my layout: <ImageView android:layout_width=fill_parent android:layout_height=wrap_content android:contentDescription=@string/image_divider android:paddingBottom=8dp android:paddingTop=4dp android:scaleType=fitXY
Assume I have the following string: Hellotoevryone<img height=115 width=150 alt= src=/Content/Edt/image/b4976875-8dfb-444c-8b32-cc b47b2d81e0.jpg />Iamsogladtoseeall. This
currently, this is the preg_replace string that I have. $mtg_post['post_content'] = preg_replace([^\\x20-\\x7e], ,$ability); This
I have this string 2012-06-27 16:17:06 and I want to convert it to GMT

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.