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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:34:46+00:00 2026-05-21T03:34:46+00:00

I am trying to match a @ tags within this string: @sam @gt @channel:sam

  • 0

I am trying to match a @ tags within this string:

 @sam @gt @channel:sam dfgfdh sam@sam

Now in regex testers this works @[\S]+ (with settings on JS testing) to pick out all strings starting with @ so in them I get:

@sam @gt @channel:sam @sam

But then in browsers using this code:

function detect_extractStatusUsers(status){
var e = new RegExp('@[\S]+', 'i');
m = e.exec(status);
var s= "";

if (m != null) {
    for (i = 0; i < m.length; i++) {
        s = s + m[i] + "\n";
    }
    alert(s);
}

return true;
}

I can only get one single match of @ (if I’m lucky, normally no match).

I must be missing something here and my eyes have just been looking at this for too long to see what it is.

Can anyone see what’s wrong in this function?

Thanks,

  • 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-21T03:34:47+00:00Added an answer on May 21, 2026 at 3:34 am

    You need to:

    • use the global search g setting
    • escape your \
    • use match instead of exec

      var e = new RegExp('@[\\S]+', 'gi');

      m = status.match(e);

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

Sidebar

Related Questions

I am trying to match <a> tags within my content and replace them with
I'm trying to highlight a match in a string by inserting <b> tags around
I'm trying to match this block here /code\ int foo(string $bar, int $bleh); Simple
I'm trying to match to expresions contained within [%___%] in a string, before //
I'm trying to come up with a Java regex that will match a filename
I'm trying to get a regex that will match: somefile_1.txt somefile_2.txt somefile_{anything}.txt but not
Im trying to do a regex where I can find all html tags, but
I'm trying to do a match in Perl, using the following regex: s/<font(.*?)>[\t\f ]*<\/font>//gi;
I have an XPath with which I'm trying to match meta tags that have
I am trying to match a paragraph: <p>content</p> A simple <p>(.*?)</p> works, but sometimes

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.