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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:03:38+00:00 2026-06-12T04:03:38+00:00

I have an regex expresion which is like this preg_match(/^\\s*(insert|delete|update|replace|create|drop|alter|use) /i,$query) This is a

  • 0

I have an regex expresion which is like this

preg_match("/^\\s*(insert|delete|update|replace|create|drop|alter|use) /i",$query)

This is a part of a pretty old function which is responsible for allmost all of the transactions on our site that we maintain (it is like 8 years old at min…)

Imagine my suprice when this query failed te test on this regex….

"DELETE
                    FROM KursSmer 
                    WHERE   IDKurs = '523' AND
                            IDSmer = '50' AND
                            IDSkolskaGodina = '1' AND
                            JeObavezan = '0'"

It took me about 1h to get the nasty fella… but i did it… there was a \n line element on the end of the first row just next to DELETE word… like DELETE\n

Now, I am left wondering if this can be corrected?

  • 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-12T04:03:39+00:00Added an answer on June 12, 2026 at 4:03 am

    You need m modifier for multiple lines.

    preg_match("/^\\s*(insert|delete|update|replace|create|drop|alter|use) /im",$query)
    

    Pattern Modifiers

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

Sidebar

Related Questions

I have these variables: boost::regex re //regular expression to use std::string stringToChange //replace this
I have a regular expression to match filenames which look like this: name -
Where I work we have a log file which contains lines like this: 31201007061308000000161639030001
I have this regular expression ([A-Z], )* which should match something like test, (with
I have deleted all <a href=></a> tags in my blog with this regex expression:
I have a problem with a difficult regex. I have this expression to detect
I have this regex that checks for a 5 digit number ^\d{5}$ How do
I have this regex that detects hashtags. It shouldn't match things with letters before
Embedly has a great regex generator with which you can use to verfiy the
I have a file which looks like below. 1 1 0 # 1 6

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.