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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:05:46+00:00 2026-06-16T15:05:46+00:00

Here’s my dilemma… I want to be able to split a string that would

  • 0

Here’s my dilemma…

I want to be able to split a string that would look like this:

/ban @User "because I told you so"

However, the problem with using spaces, @, or quotation marks as delimiters for the string is that the user’s name can contain a wide array of special characters. AND, chances are, those special characters might be able to conflict with processing the command.

For example:

/ban @Person" "because why not"

Wouldn’t work, nor would

/ban @Person"name" "reason"

How can I accurately process something like this when any of the characters I could use to split up the string could easily be emulated by the targeted user’s name to break the command? Is this even possible at all? I’ll be honest, RegExp is kind of daunting for me to understand or look at, so if this is a simple regex fix, I apologize 🙁

Thanks a ton to a solution, I now have a working processor:

    var yourRegex = /^@(.*?) "([^"]+)"$/;

Since I can already take the /ban out (other commands like /kick, etc. as it’s not exclusively this one command) I just chopped that out of the regexp. I also moved the @ symbol out since I don’t need that to target the user. Works 100% 😀

  • 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-16T15:05:47+00:00Added an answer on June 16, 2026 at 3:05 pm

    Try this:

    /^\/ban (@.*?) "([^"]+)"$/
    

    This will give you the username in the first subpattern (with leading @ symbol, just move it outside the parentheses if you want to exclude it), and the reason in the second (without the quotes around it, move them inside the parens to include them).

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

Sidebar

Related Questions

Here's the situation, i want to have a user that can enter time on
Here is what I want to do. Use this HTML line and have the
Here is a scenario: User installs .NET application that you have made. After some
Here's the problem....I have three components...A Page that contains a User Control and a
Here is an object that I'd like to use with ng-repeat, but it's not
Here is what I am trying to achieve in PHP: I have this string:
Here is my demo code I want to disable td with this content 'CLICKING
Here is the code in a function I'm trying to revise. This example works
Here is the code: create table `team`.`User`( `UserID` bigint NOT NULL AUTO_INCREMENT , `Username`
Here's my problem I have this javascript if (exchRate != ) { function roundthecon()

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.