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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:06:51+00:00 2026-06-13T18:06:51+00:00

i am trying to code a search function to search in strings and find

  • 0

i am trying to code a search function to search in strings and find the word

like the php + mysql for example

Select * From Column Where ID Like %Word%

i tried to code the same idea with Preg match all and regex

Here is my code

$strings = '
( monstername 205 "Devil Troop of Desire")
( monstername 206 "  Devil Troop of Pain     "  )
( monstername 207       "Devil Troop of Greed")
( monstername 208   "       Devil Troop of Jealousy  ")
( monstername 207 "Mask Troop of Greed"  )';

preg_match_all('/monstername\s*(.*?)\s*\"\s*\\b(Jealousy)\b\s*\"\s*\)/i', $strings, $matches, PREG_SET_ORDER);
foreach ($matches as $match){list (, $MonsterNumber) = $match;
echo "$MonsterNumber";
}

the output should be

208

but it dont display the output correct

it display it when i replace Jealousy With Devil Troop of Jealousy

i just want to do the same idea of php + mysql

Where ID Like %Word%

without give the full string to find the number of monster

  • 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-13T18:06:53+00:00Added an answer on June 13, 2026 at 6:06 pm

    The part "\s*\\b(Jea does not allow for other characters than whitespace between the quote and the start of the word. You probably wanted any char (or even none?) between them, like ".*\\b(Jea and the same problem after the word.

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

Sidebar

Related Questions

I am trying to code the following query using Zend_Db api's: select * from
Possible Duplicate: Simple PHP strpos function not working, why? I'm trying to search a
I'm trying the following code to execute a search and it's not working. On
I am having an issue converting type. I was trying code like this (minimal,
I'm trying to code a basic 'display a map from KML' website, and am
I'm trying to find out why this entire code below is producing only ONE
I am trying to create a function that will split a string into search
Im trying to implement a search function for when the user enters text in
I am trying to create a search function that allows the user to search
I am trying to convert a Java function into equivalent Groovy code, but I

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.