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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:42:35+00:00 2026-05-26T11:42:35+00:00

HI I am working on a rails application. I want to implement user tagging

  • 0

HI I am working on a rails application. I want to implement user tagging as facebook or twitter does. When user is posting in feed he can tag any user with @ character at starting.

I am using Jquery UI Autocomplete plugin.

I have this reference
Implementing jquery UI autocomplete to show suggestions when you type "@" which helped me to implement auto complete part.

But now I want to link that auto completed username to users profile url e.g Username = Mak then link should be generated like

<a href="http://www.example.com/username">Username</a>

So please guide me how can I implement this in my rails application?Is there any gem to do so.

  • 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-26T11:42:36+00:00Added an answer on May 26, 2026 at 11:42 am

    Hey it doesn’t required above methods. I did it using simple regex.

    <% @str = @madyrocks solved problem of @username tagging %>
    
    <%=@result_string = @str.gsub(/(\^|\s|\B)@(([a-zA-Z])(_?[a-zA-Z0-9]+)*|_([a-zA-Z0-9]+_?)*)/i, 
    %Q{ <a href="http://example.com/\\2">\@\\2</a>}) %>
    

    In my regex I have used (\^|\s|\B) because @ can occur at start of string or after a white space while tagging a user.

    ([a-zA-Z])(_?[a-zA-Z0-9]+)*|_([a-zA-Z0-9]+_?)* This is used to validate username. In my application username must start with alphabet followed by alphabets & numbers.

    The no. 2 used to take second match in regex.

    For more details try the regex on Rubular.com

    I hope this will help others.

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

Sidebar

Related Questions

I'm trying to get tags working in my rails application and want to use
I am working on a rails application. I have implemented facebook integration in my
I am working on Ruby on Rails application, with Prototype. I want to display
I'm working on a Rails application with some budget features... What i want to
I am working on my first Rails application and want to create an admin
in my rails web application I am implementing Facebook connectivity. I want that whenever
I am working with Rails fixtures for testing my rails application. It is all
I am working on a Rails application that needs to handle dates and times
I am working on a rails application (I have some experience with rails). But,
I'm working on a Rails application where I have some a set of two

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.