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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:22:09+00:00 2026-05-26T08:22:09+00:00

I am trying to match some link from some texts: $reg = ‘#ok is

  • 0

I am trying to match some link from some texts:

$reg = '#ok is it http://google.com/?s=us#';
$page = 'Well i think ! ok is it http://google.com/?s=us&ui=pl0 anyways it ok';

if(preg_match($reg,$page)){
  echo 'it work'; 
}else{
  echo 'not work';
}

Now the problem is , if i use $reg = '#ok is it http://google.com/'; then its ok but when i use that one with “?=” it doesnt.

ok ! i understand there is some problem of syntax error is there any function or ready made function which automatically escape these special characters ?

  • 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-26T08:22:10+00:00Added an answer on May 26, 2026 at 8:22 am

    You have a lot of syntax errors. You must escape all the special chars as ‘.’, ‘?’ and so on. Thus you have to replace the chars like this:

    '.' -> '\.'
    '?' -> '\?'
    ...
    

    Anyway, the regex should be like this:

    $reg = '#ok is it http:\/\/google\.com/\?s=us#';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to extract the price from the bellow html page/link using php cURL
I'm trying to get regexp to match some nested tags. (Yes I know I
I need some help trying to match a C include file with full path
I'm trying to insert some symbols from LaTeX Math Symbols into my LaTeX document:
Im trying to append some JSON data from the last.fm API, I have been
I'm trying to split some html content using php's preg-match-all function: <li class=cat-item><a title=blabla
I'm trying to match everything from the last occurrence of either keyword (foo or
I'm trying to pass some values through a link and I want them to
I'm trying to do some date math in Visual Basic. The NETWORKDAYS function in
I'm trying to reteach myself some long forgotten math skills. This is part of

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.