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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:20:58+00:00 2026-06-15T15:20:58+00:00

I am trying to fix how a user’s name is being pulled into an

  • 0

I am trying to fix how a user’s name is being pulled into an HTML page from a LMS (Learning Management System). Currently there are two separate inputs for first and last name. A user wants to add their middle name so we had them add it to the first name input box like so:

First Name: John Ray

Last Name: Doe

Our code to pull in their name to an HTML page looks like this:

var strStudentName;

if (typeof opener != "undefined" && typeof opener.LMS_student_name != "undefined" && opener.LMS_student_name != null)
{
    strStudentName = opener.LMS_student_name;
}
else
{
    strStudentName = "the Student";
}

var objRegExp = /(\w+),(\w+)/;
var strReverseName = strStudentName.replace(objRegExp, "$2 $1");

Unfortunately this code displays their middle name last “John Doe Ray.” I would like it to read “John Ray Doe.” If I switch the $2 and $1 it will read “Doe John Ray” No matter what I do the middle name is always last!

The original purpose of this code was to put the user’s first name first because the LMS defaults their name backwards like (Doe, John).

Please help! Thank you!!

  • 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-15T15:20:59+00:00Added an answer on June 15, 2026 at 3:20 pm

    Depending on your input data, you might not need to specify word characters in your second capture group – if your input is self-contained then /(\w+),(.+)/; will work.

    If you’ve got more characters after the name string, though, we’ll need more information as to what those characters are in order to correctly specify the regex.

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

Sidebar

Related Questions

I am trying to fix some HTML, and it is working perfect. But one
I'm very new to Ruby on Rails and learning while trying to fix some
I'm trying to build generic function that get from user string and try to
I'm trying to use an editable JComboBox such that upon a user typing into
In a spreadsheet i'm trying to fix up, on the final page i want
I'm trying to store a user's post into an access database through a web
I'm trying to fetch events from the user's Calendar app. That itself works fine,
I trying to fix a strange bugg. People with IOS 4 can't even start
I've been trying to fix this problems for a few hours already, I cannot
I am trying to fix a regular input box with padding, border, inside a

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.