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

The Archive Base Latest Questions

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

If a user submits a string like: My living room plans #plans #livingroom @cbmeeks

  • 0

If a user submits a string like:

My living room plans #plans #livingroom @cbmeeks #design @moe @larry -this is cool!

I want to have the following arrays/strings:

text = "My living room plans"
tags = ['plans', 'livingroom', 'design']
people = ['cbmeeks', 'moe', 'larry']
description = "this is cool!"

Every string submitted will start with the text piece. No @, -, etc. I don’t have to worry about a user starting with a tag or person. The breakdown should look something like this, in any order except TEXT is always first.

TEXT [-description] [#tags] [@people]

EDIT
I can’t seem to figure out how to grab them correctly. For example:

a = "My living room plans #plans #livingroom @cbmeeks #design @moe @larry -this is cool!"

/#\w+/.match(a).to_a
#=> ["#plans"] -- only grabs first one
  • 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-28T01:13:42+00:00Added an answer on May 28, 2026 at 1:13 am

    This will automatically remove the #, @, -, and will match in any order:

    string = "My living room plans #plans #livingroom @cbmeeks #design @moe @larry -this is cool!"
    text = string[/^(.*?)+(?=\s[@#-])/]
    tags = string.scan /(?<=#)\w+/
    people = string.scan /(?<=@)\w+/
    description = string[/(?<=-)(.*?)+?(?=($|\s[@#]))/]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have situation like this: user submits form with action='/pay' in '/pay' I have
I want to Unit-test a method like the following: public ActionResult StoreFile(FormCollection form, string
Im trying to submit user register information with AJAX like this: <script> $(#submit_btn).click(function() {
For example: A user submits a form with a <textarea name=mytext cols=35 rows=2></textarea> and
I have form where user submits field. Field can have letters, numbers, and punctuation.
After a user submits a form, how do you detect that the form has
I have a form that the user submits and returns a result, but it
I have a page where a user submits an order, and after they submit
I have a scenario where a user submits a start and stop date for
I need to hide a form on my page once a user submits it.

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.