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

  • Home
  • SEARCH
  • 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 6574943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:19:35+00:00 2026-05-25T15:19:35+00:00

I needed to grep some files on a server so I quickly hacked out

  • 0

I needed to grep some files on a server so I quickly hacked out and tested a regexp in a javascript console to meet my needs:

var regexp = /mssql_query\s*\([\"\'][a-z0-9_\s]*(_sp|usp_)/i

// want to pass
regexp.test('mssql_query ("something_sp')
regexp.test('mssql_query("exec something_sp')
regexp.test("mssql_query('something_else_sp")
regexp.test('mssql_query("_usp_sp')
regexp.test('mssql_query ("_usp_somethig')
regexp.test("mssql_query('_usp_something_else")

// want to fail
regexp.test('mssql_query ("something_s')
regexp.test('mssql_query("exec something_p')
regexp.test('mssql_query("select')

The expression works perfectly for all the test cases I threw at it, however I can’t seem to get the expression to work with grep.
Is there a way to convert an EMCA expression to an ERE or BRE expression so I can use it with grep or sed?

I’ve tried tweaking it to work in grep but have failed miserably.

  • 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-25T15:19:36+00:00Added an answer on May 25, 2026 at 3:19 pm
    grep "mssql_query *([\"\'][a-z0-9_ ]*_sp\|usp_" 
    

    ought to do the job. It is looking for:

    1. mssql_query, then
    2. 0 or more spaces (that’s the " *"), then
    3. (, then ” or ‘ (that’s the ([\"\']), then
    4. 0 or more characters that are lowercase letters, numbers, underscores or spaces (that’s the [a-z0-9_ ]*), then
    5. _sp or usp_ (that’s the _sp\|usp_)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I needed to forward stdout to different files to separate some prints produced and
I needed some simple string encryption, so I wrote the following code (with a
I needed to find all the files that contained a specific string pattern. The
I needed to work with Facebook SDK, so with some help, I wrote script
I needed some help/pointers on a homework problem. I would really appreciate it if
I needed to move some src/test/java to src/main/java according to this recommandation from maven-jar-plugin
Brainstorming needed . I have a problem with Javascript libraries (jQuery, ExtJS etc.) that
It needs to be graphical. No sed, awk, grep, perl, whatever. I know how
Yesterday a situation came up where someone needed me to separate out the tail
I needed to wrap some Linq queries with some Retry Policy logic. Is 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.