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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T03:08:22+00:00 2026-05-17T03:08:22+00:00

Ok, here again. I’ll promise to study deeply the regular expression soon :P Language:

  • 0

Ok, here again.
I’ll promise to study deeply the regular expression soon 😛

Language: PhP

Problem:
Match if some badword exist inside a string and do something.
The word must be not included inside a “greater word”. I mean if i’ll search for “rob” (sorry Rob, i’m not thinking you’re a badword), the word “problem have to pass without check.

I’d googled around but found nothing good for me. So, I thought something like this:

If i match the word with after and before any character of the following:

  • .
  • ,
  • ;
  • :
  • !
  • ?
  • (
  • )
  • +
  • –
  • [whitespace]

I can simulate a check against single word inside a string.

Finally the Questions:

  1. There’s a better way to do it?
  2. If not, which will be the correct regexp to consider [all_that_char]word[all_that_char]?

Thanks in advance to anyone would help!
Maybe this is a very stupid question but today is one of that day when move our neurons causes an incredible headache 😐

  • 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-17T03:08:22+00:00Added an answer on May 17, 2026 at 3:08 am

    Look up \b (word boundary):

    Matches at the position between a word
    character (anything matched by \w) and
    a non-word character (anything matched
    by [^\w] or \W) as well as at the
    start and/or end of the string if the
    first and/or last characters in the
    string are word characters.

    (http://www.regular-expressions.info/reference.html)

    So: \brob\b matches rob, but not problem.

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

Sidebar

Related Questions

Edit: You can get the full source here: http://pastebin.com/m26693 Edit again: I added some
i'm here again to ask help regarding my problem with the view that i
hello master around the world, im here again with a problem :D now i
I'm here again asking questions. I hope somebody would put some effort in answering
I'm here again with another question/problem. I know that topic's title may be like
Here's my regular expression that I have for this. I'm in Ruby, which —
I'm stuck here again. I have a database with over 120 000 coordinates that
I am Manoj again here to ask you my doubts. I heard that in
Here we go again, the old argument still arises... Would we better have a
Once again a very beginner-ish question, but here I go: I would like to

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.