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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:21:25+00:00 2026-05-23T11:21:25+00:00

thanks for reading my question. I am using a RegExp object in actionscript to

  • 0

thanks for reading my question.

I am using a RegExp object in actionscript to simply test the occurrence of one string inside another. Sometimes the Strings may contain RegEx special characters, i.e. “*”.

To handle that I have been concatenating \Q to the beginning of the search string, like so…

(String(reportItem[attributeToSearch])).search(new RegExp(("\Q" + searchText), "i"))

That is currently working for larger strings and for the string “*“.
However, I’ve come across a problem where the String I am searching is “projectiles, with bursting charge”. I am search for “,s” and it gives me back -1 as a result. If I search the same thing without the \Q it works fine, but then the “*” case breaks.

What gives?!

Thanks in advance!

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

    You need to escape the \ in the \Q

    new RegExp(("\\Q" + searchText), "i");
    

    Try this:

    var regExp:RegExp;
    regExp = new RegExp("\Qs,", "i");
    trace(regExp.toString()); //    /Qs,/i
    
    regExp = /\Qs,/i;               
    trace(regExp.toString()); //    /\Qs,/i
    
    regExp = new RegExp("\\Qs,", "i");
    trace(regExp.toString()); //    /\Qs,/i
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If you're reading my question, thanks, I appreciate your help I'm using Wamp on
Hello and thanks to everyone for reading my question. I've been working on a
Thanks in Advance for reading and answer this question. I got button in asp
Thanks for reading this. I have markup similar to what is below. Using the
Hi Thanks for reading my question. I currently use Mac Terminal to use MySQL.
This question is about using getter methods of a singleton object in worker threads.
Thanks for reading my question. I saw Gizmodo & Lifehacker has this feature. Take
Thanks for reading my question! I have a problem with customizing a DataGrid RowGroupHeader,
Thanks for reading. I'm a bit new to jQuery, and am trying to make
Thanks for reading this. I am dynamically generating some data which includes a select

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.